| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "base/sys_string_conversions.h" | 25 #include "base/sys_string_conversions.h" |
| 26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
| 27 #include "base/time.h" | 27 #include "base/time.h" |
| 28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
| 29 #include "base/values.h" | 29 #include "base/values.h" |
| 30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 31 #include "chrome/browser/about_flags.h" | 31 #include "chrome/browser/about_flags.h" |
| 32 #include "chrome/browser/background/background_mode_manager.h" | 32 #include "chrome/browser/background/background_mode_manager.h" |
| 33 #include "chrome/browser/browser_process_impl.h" | 33 #include "chrome/browser/browser_process_impl.h" |
| 34 #include "chrome/browser/browser_shutdown.h" | 34 #include "chrome/browser/browser_shutdown.h" |
| 35 #include "chrome/browser/chrome_browser_main_gtk.h" | |
| 36 #include "chrome/browser/chrome_browser_main_win.h" | |
| 37 #include "chrome/browser/defaults.h" | 35 #include "chrome/browser/defaults.h" |
| 38 #include "chrome/browser/extensions/default_apps_trial.h" | 36 #include "chrome/browser/extensions/default_apps_trial.h" |
| 39 #include "chrome/browser/extensions/extension_protocols.h" | 37 #include "chrome/browser/extensions/extension_protocols.h" |
| 40 #include "chrome/browser/extensions/extension_service.h" | 38 #include "chrome/browser/extensions/extension_service.h" |
| 41 #include "chrome/browser/extensions/extensions_startup.h" | 39 #include "chrome/browser/extensions/extensions_startup.h" |
| 42 #include "chrome/browser/first_run/first_run_browser_process.h" | 40 #include "chrome/browser/first_run/first_run_browser_process.h" |
| 43 #include "chrome/browser/first_run/upgrade_util.h" | 41 #include "chrome/browser/first_run/upgrade_util.h" |
| 44 #include "chrome/browser/google/google_url_tracker.h" | 42 #include "chrome/browser/google/google_url_tracker.h" |
| 45 #include "chrome/browser/google/google_util.h" | 43 #include "chrome/browser/google/google_util.h" |
| 46 #include "chrome/browser/instant/instant_field_trial.h" | 44 #include "chrome/browser/instant/instant_field_trial.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 #include "net/url_request/url_request_throttler_manager.h" | 111 #include "net/url_request/url_request_throttler_manager.h" |
| 114 #include "net/websockets/websocket_job.h" | 112 #include "net/websockets/websocket_job.h" |
| 115 #include "ui/base/l10n/l10n_util.h" | 113 #include "ui/base/l10n/l10n_util.h" |
| 116 #include "ui/base/resource/resource_bundle.h" | 114 #include "ui/base/resource/resource_bundle.h" |
| 117 | 115 |
| 118 #if defined(USE_LINUX_BREAKPAD) | 116 #if defined(USE_LINUX_BREAKPAD) |
| 119 #include "base/linux_util.h" | 117 #include "base/linux_util.h" |
| 120 #include "chrome/app/breakpad_linux.h" | 118 #include "chrome/app/breakpad_linux.h" |
| 121 #endif | 119 #endif |
| 122 | 120 |
| 123 #if defined(TOOLKIT_USES_GTK) | |
| 124 #include "chrome/browser/ui/gtk/gtk_util.h" | |
| 125 #endif | |
| 126 | |
| 127 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 121 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 128 #include "chrome/browser/first_run/upgrade_util_linux.h" | 122 #include "chrome/browser/first_run/upgrade_util_linux.h" |
| 129 #endif | 123 #endif |
| 130 | 124 |
| 131 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
| 132 #include "chrome/browser/chromeos/audio_handler.h" | 126 #include "chrome/browser/chromeos/audio_handler.h" |
| 133 #include "chrome/browser/chromeos/boot_times_loader.h" | 127 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 134 #include "chrome/browser/chromeos/cros_settings_names.h" | 128 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 135 #include "chrome/browser/chromeos/cros/cros_library.h" | 129 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 136 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 130 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 152 // TODO(port): several win-only methods have been pulled out of this, but | 146 // TODO(port): several win-only methods have been pulled out of this, but |
| 153 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 147 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 154 // other platforms. For now, it's just a stub. This is a serious work in | 148 // other platforms. For now, it's just a stub. This is a serious work in |
| 155 // progress and should not be taken as an indication of a real refactoring. | 149 // progress and should not be taken as an indication of a real refactoring. |
| 156 | 150 |
| 157 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
| 158 #include "base/environment.h" // For PreRead experiment. | 152 #include "base/environment.h" // For PreRead experiment. |
| 159 #include "base/win/windows_version.h" | 153 #include "base/win/windows_version.h" |
| 160 #include "chrome/browser/browser_trial.h" | 154 #include "chrome/browser/browser_trial.h" |
| 161 #include "chrome/browser/browser_util_win.h" | 155 #include "chrome/browser/browser_util_win.h" |
| 156 #include "chrome/browser/chrome_browser_main_win.h" |
| 162 #include "chrome/browser/first_run/try_chrome_dialog_view.h" | 157 #include "chrome/browser/first_run/try_chrome_dialog_view.h" |
| 163 #include "chrome/browser/first_run/upgrade_util_win.h" | 158 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 164 #include "chrome/browser/fragmentation_checker_win.h" | 159 #include "chrome/browser/fragmentation_checker_win.h" |
| 165 #include "chrome/browser/net/url_fixer_upper.h" | 160 #include "chrome/browser/net/url_fixer_upper.h" |
| 166 #include "chrome/browser/rlz/rlz.h" | 161 #include "chrome/browser/rlz/rlz.h" |
| 167 #include "chrome/browser/ui/views/user_data_dir_dialog.h" | 162 #include "chrome/browser/ui/views/user_data_dir_dialog.h" |
| 168 #include "chrome/installer/util/helper.h" | 163 #include "chrome/installer/util/helper.h" |
| 169 #include "chrome/installer/util/install_util.h" | 164 #include "chrome/installer/util/install_util.h" |
| 170 #include "chrome/installer/util/shell_util.h" | 165 #include "chrome/installer/util/shell_util.h" |
| 171 #include "content/browser/user_metrics.h" | 166 #include "content/browser/user_metrics.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 186 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 181 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 187 #include "views/desktop/desktop_window_view.h" | 182 #include "views/desktop/desktop_window_view.h" |
| 188 #include "views/focus/accelerator_handler.h" | 183 #include "views/focus/accelerator_handler.h" |
| 189 #include "views/widget/widget.h" | 184 #include "views/widget/widget.h" |
| 190 #if defined(TOOLKIT_USES_GTK) | 185 #if defined(TOOLKIT_USES_GTK) |
| 191 #include "views/widget/native_widget_gtk.h" | 186 #include "views/widget/native_widget_gtk.h" |
| 192 #endif | 187 #endif |
| 193 #endif | 188 #endif |
| 194 | 189 |
| 195 #if defined(TOOLKIT_USES_GTK) | 190 #if defined(TOOLKIT_USES_GTK) |
| 191 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 196 #include "ui/gfx/gtk_util.h" | 192 #include "ui/gfx/gtk_util.h" |
| 197 #endif | 193 #endif |
| 198 | 194 |
| 199 #if defined(TOUCH_UI) | 195 #if defined(TOUCH_UI) |
| 200 #include "ui/base/touch/touch_factory.h" | 196 #include "ui/base/touch/touch_factory.h" |
| 201 #endif | 197 #endif |
| 202 | 198 |
| 199 #if defined(USE_X11) |
| 200 #include "chrome/browser/chrome_browser_main_x11.h" |
| 201 #endif |
| 202 |
| 203 #if defined(USE_AURA) | 203 #if defined(USE_AURA) |
| 204 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 204 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 205 #include "ui/aura/desktop.h" | 205 #include "ui/aura/desktop.h" |
| 206 #include "ui/aura_shell/shell.h" | 206 #include "ui/aura_shell/shell.h" |
| 207 #endif | 207 #endif |
| 208 | 208 |
| 209 namespace net { | 209 namespace net { |
| 210 class NetLog; | 210 class NetLog; |
| 211 } // namespace net | 211 } // namespace net |
| 212 | 212 |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 | 1459 |
| 1460 // If the command line specifies 'uninstall' then we need to work here | 1460 // If the command line specifies 'uninstall' then we need to work here |
| 1461 // unless we detect another chrome browser running. | 1461 // unless we detect another chrome browser running. |
| 1462 if (parsed_command_line().HasSwitch(switches::kUninstall)) { | 1462 if (parsed_command_line().HasSwitch(switches::kUninstall)) { |
| 1463 return DoUninstallTasks(already_running); | 1463 return DoUninstallTasks(already_running); |
| 1464 } | 1464 } |
| 1465 #endif | 1465 #endif |
| 1466 | 1466 |
| 1467 if (parsed_command_line().HasSwitch(switches::kHideIcons) || | 1467 if (parsed_command_line().HasSwitch(switches::kHideIcons) || |
| 1468 parsed_command_line().HasSwitch(switches::kShowIcons)) { | 1468 parsed_command_line().HasSwitch(switches::kShowIcons)) { |
| 1469 return HandleIconsCommands(parsed_command_line()); | 1469 return HandleIconsCommands(); |
| 1470 } | 1470 } |
| 1471 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { | 1471 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { |
| 1472 return ShellIntegration::SetAsDefaultBrowser() ? | 1472 return ShellIntegration::SetAsDefaultBrowser() ? |
| 1473 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : | 1473 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : |
| 1474 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); | 1474 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 // If the command line specifies --pack-extension, attempt the pack extension | 1477 // If the command line specifies --pack-extension, attempt the pack extension |
| 1478 // startup action and exit. | 1478 // startup action and exit. |
| 1479 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { | 1479 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 #endif // OS_POSIX | 1677 #endif // OS_POSIX |
| 1678 } // if (!first_run_ui_bypass) | 1678 } // if (!first_run_ui_bypass) |
| 1679 | 1679 |
| 1680 Browser::SetNewHomePagePrefs(user_prefs); | 1680 Browser::SetNewHomePagePrefs(user_prefs); |
| 1681 g_browser_process->profile_manager()->OnImportFinished(profile_); | 1681 g_browser_process->profile_manager()->OnImportFinished(profile_); |
| 1682 } // if (is_first_run) | 1682 } // if (is_first_run) |
| 1683 | 1683 |
| 1684 // Sets things up so that if we crash from this point on, a dialog will | 1684 // Sets things up so that if we crash from this point on, a dialog will |
| 1685 // popup asking the user to restart chrome. It is done this late to avoid | 1685 // popup asking the user to restart chrome. It is done this late to avoid |
| 1686 // testing against a bunch of special cases that are taken care early on. | 1686 // testing against a bunch of special cases that are taken care early on. |
| 1687 PrepareRestartOnCrashEnviroment(parsed_command_line()); | 1687 PrepareRestartOnCrashEnviroment(); |
| 1688 | 1688 |
| 1689 // Start watching for hangs during startup. We disarm this hang detector when | 1689 // Start watching for hangs during startup. We disarm this hang detector when |
| 1690 // ThreadWatcher takes over or when browser is shutdown. | 1690 // ThreadWatcher takes over or when browser is shutdown. |
| 1691 StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300)); | 1691 StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300)); |
| 1692 | 1692 |
| 1693 #if defined(OS_WIN) | 1693 #if defined(OS_WIN) |
| 1694 // Registers Chrome with the Windows Restart Manager, which will restore the | 1694 // Registers Chrome with the Windows Restart Manager, which will restore the |
| 1695 // Chrome session when the computer is restarted after a system update. | 1695 // Chrome session when the computer is restarted after a system update. |
| 1696 // This could be run as late as WM_QUERYENDSESSION for system update reboots, | 1696 // This could be run as late as WM_QUERYENDSESSION for system update reboots, |
| 1697 // but should run on startup if extended to handle crashes/hangs/patches. | 1697 // but should run on startup if extended to handle crashes/hangs/patches. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2092 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
| 2093 (pre_read == "0" || pre_read == "1")) { | 2093 (pre_read == "0" || pre_read == "1")) { |
| 2094 std::string uma_name(name); | 2094 std::string uma_name(name); |
| 2095 uma_name += "_PreRead"; | 2095 uma_name += "_PreRead"; |
| 2096 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2096 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
| 2097 AddPreReadHistogramTime(uma_name.c_str(), time); | 2097 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2098 } | 2098 } |
| 2099 #endif | 2099 #endif |
| 2100 #endif | 2100 #endif |
| 2101 } | 2101 } |
| OLD | NEW |