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