Advertisement
parabola949

chromium build and modify

Mar 18th, 2015
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 KB | None | 0 0
  1. BEFORE YOU BEGIN:
  2. This process will take a few hours, as well as ~50GB of HDD space - make sure you have room!!!
  3. Also, I HIGHLY recommend doing this on an SSD if at all possible, will save a LOT of time
  4. For the file editing, I also recommend using notepad++ (installer is included, you're welcome)
  5. There is a batch file included at the end of this file, as well as in the build folder.
  6. You MUST have depot_tools installed and the path set before you run the batch
  7. Side note: not sure yet, but this whole process MAY require Visual Studio to be installed in order to compile....
  8.  
  9. Download depot tools
  10. https://src.chromium.org/svn/trunk/tools/depot_tools.zip
  11.  
  12. Extract somewhere, add that path to %PATH%
  13. (control.exe sysdm.cpl,System,3) to get to the environment variables quickly
  14. Add/set the following variables:
  15. [USER]
  16. GOOGLE_API_KEY: no
  17. GOOGLE_DEFAULT_CLIENT_ID: no
  18. GOOGLE_DEFAULT_CLIENT_SECRET: no
  19.  
  20. [SYSTEM]
  21. DEPOT_TOOLS_WIN_TOOLCHAIN: 0
  22.  
  23. open command prompt, navigate to the directory where you want the chromium source
  24. Run this command:
  25. fetch --nohooks --no-history chromium
  26. This will download the chromium source. Wait... takes a very very long time
  27. cd into src
  28. Run:
  29. gclient runhooks
  30. This will install git as well as many needed packages, takes some time to complete (go grab a coffee)
  31.  
  32. For reference: the reason you are manually doing these code changes is because chromium source changes constantly, and if I provide you with the files, it will most likely break something
  33.  
  34. Go to src\base, open command_line.cc
  35. Find this method definition:
  36.  
  37. #if defined(OS_WIN)
  38. void CommandLine::ParseFromString(const string16& command_line) {
  39.  
  40. We need to modify this function to hardcode our switches
  41. At the beginning of the method, add this (modify as needed, switches are below)
  42. string16 hard_codes = L"--bwsi --app=https://secure.stratanetwork.com/StrataJazz/login.aspx --disable-sync --no-default-browser-check --disable-extensions --no-first-run --disable-contextual-search";
  43.  
  44. Now find this line in the same method:
  45. TrimWhitespace(command_line, TRIM_ALL, &command_line_string);
  46. Modify:
  47. TrimWhitespace(command_line + hard_codes, TRIM_ALL, &command_line_string);
  48.  
  49. Switches: http://peter.sh/experiments/chromium-command-line-switches/
  50. --bwsi Indicates that the browser is in "browse without sign-in" (Guest session) mode. Should completely disable extensions, sync and bookmarks.
  51. --app=<url> Runs chrome in application mode (removed all toolbars, etc)
  52. --disable-extensions
  53. --disable-sync Disables syncing browser data to a Google Account.
  54. --force-app-mode Forces application mode. This hides certain system UI elements and forces the app to be installed if it hasn't been already.
  55. --homepage
  56. --no-default-browser-check
  57. --no-first-run
  58. --disable-contextual-search
  59.  
  60. Save command_line.cc
  61. Next, disable new windows and new tabs
  62. src\chrome\browser\ui\browser_commands.cc
  63.  
  64. for each of the following methods, add return; on the line after the definition:
  65. example:
  66. void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) {
  67. return;
  68.  
  69. void SavePage(Browser* browser) {
  70. void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action) {
  71. bool CanOpenTaskManager() {
  72. return false; <- use false on this one
  73. void ViewSource(Browser* browser, WebContents* contents) {
  74. void NewEmptyWindow(Profile* profile, HostDesktopType desktop_type) {
  75. void NewWindow(Browser* browser) {
  76. void NewIncognitoWindow(Browser* browser) {
  77. void NewTab(Browser* browser) {
  78.  
  79. Save the file
  80.  
  81. Now, disable the context menu
  82. src\chrome\browser\render_context_menu\render_view_context_menu.cc
  83.  
  84. Find:
  85. void RenderViewContextMenu::InitMenu() {
  86. RenderViewContextMenuBase::InitMenu();
  87.  
  88. add return; on the next line:
  89. void RenderViewContextMenu::InitMenu() {
  90. RenderViewContextMenuBase::InitMenu();
  91. return;
  92.  
  93. Disable chrome opening a new browser (for things like "open link in new tab / window")
  94. src\chrome\browser\ui\browser_navigator.cc
  95. Find the method:
  96. Browser* GetOrCreateBrowser
  97. add return browser; as the first line
  98. Browser* GetOrCreateBrowser(Profile* profile,
  99. chrome::HostDesktopType host_desktop_type) {
  100. Browser* browser = chrome::FindTabbedBrowser(profile, false,
  101. host_desktop_type);
  102. return browser;
  103. }
  104.  
  105. Now, we need to build the source
  106. In your command prompt again (make sure you are in the src directory - cd src), run this command:
  107. ninja -C out\Release chrome
  108. First build, it will build ~20K files, so again, go do something else (maybe go get lunch, or some cold water because you sipped that coffee while it was still too hot...)
  109.  
  110. now build the mini installer:
  111. ninja -C out\Release mini_installer
  112.  
  113. Once complete, you'll find the mini_installer.exe in the Release folder
  114. ---------------------------------------------------------------------------------------------------------------------
  115. ---------------------------------------------------------------------------------------------------------------------
  116. ---------------------------------------------------------------------------------------------------------------------
  117. ---------------------------------------------------------------------------------------------------------------------
  118.  
  119. BATCH FILE (do after installing depot_tools and setting %PATH% variable)
  120. Note the path variable on the first line and use of notepad++
  121.  
  122. SET CHROMIUMBUILDPATH=c:\chrome
  123. SET GOOGLE_API_KEY no
  124. SET GOOGLE_DEFAULT_CLIENT_ID no
  125. SET GOOGLE_DEFAULT_CLIENT_SECRET no
  126. SET DEPOT_TOOLS_WIN_TOOLCHAIN 0
  127. mkdir %CHROMIUMBUILDPATH%
  128. mkdir %CHROMIUMBUILDPATH%\chromium
  129. cd %CHROMIUMBUILDPATH%\chromium
  130. fetch --nohooks --no-history chromium
  131. cd src
  132. gclient runhooks
  133. notepad++ \src\base\command_line.cc
  134. notepad++ \src\chrome\browser\ui\browser_commands.cc
  135. notepad++ \src\chrome\browser\render_context_menu\render_view_context_menu.cc
  136. notepad++ \src\chrome\browser\ui\browser_navigator.cc
  137. pause
  138. cd out\Release chrome
  139. ninja chrome
  140. ninja mini_installer
  141. mkdir %CHROMIUMBUILDPATH%\ready
  142. copy mini_installer.exe %CHROMIUMBUILDPATH%\ready\mini_installer.exe
  143. robocopy obj\chrome\installer\mini_installer.gen\temp_installer_archive\Chrome-bin\ %CHROMIUMBUILDPATH%\ready\ /MIR
  144. cd %CHROMIUMBUILDPATH%\ready
  145. chrome.exe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement