OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 19 matching lines...) Expand all Loading... |
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/browser_process.h" | 33 #include "chrome/browser/browser_process.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_extra_parts.h" | 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
37 #include "chrome/browser/defaults.h" | 37 #include "chrome/browser/defaults.h" |
38 #include "chrome/browser/extensions/extension_protocols.h" | 38 #include "chrome/browser/extensions/extension_protocols.h" |
39 #include "chrome/browser/extensions/extension_service.h" | 39 #include "chrome/browser/extensions/extension_service.h" |
40 #include "chrome/browser/extensions/extensions_startup.h" | 40 #include "chrome/browser/extensions/startup_helper.h" |
41 #include "chrome/browser/first_run/upgrade_util.h" | 41 #include "chrome/browser/first_run/upgrade_util.h" |
42 #include "chrome/browser/google/google_search_counter.h" | 42 #include "chrome/browser/google/google_search_counter.h" |
43 #include "chrome/browser/google/google_util.h" | 43 #include "chrome/browser/google/google_util.h" |
44 #include "chrome/browser/gpu_blacklist.h" | 44 #include "chrome/browser/gpu_blacklist.h" |
45 #include "chrome/browser/jankometer.h" | 45 #include "chrome/browser/jankometer.h" |
46 #include "chrome/browser/language_usage_metrics.h" | 46 #include "chrome/browser/language_usage_metrics.h" |
47 #include "chrome/browser/managed_mode.h" | 47 #include "chrome/browser/managed_mode.h" |
48 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 48 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
49 #include "chrome/browser/metrics/metrics_log.h" | 49 #include "chrome/browser/metrics/metrics_log.h" |
50 #include "chrome/browser/metrics/metrics_service.h" | 50 #include "chrome/browser/metrics/metrics_service.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // directory switch. | 453 // directory switch. |
454 DCHECK(!command_line.HasSwitch(switches::kProfileDirectory)); | 454 DCHECK(!command_line.HasSwitch(switches::kProfileDirectory)); |
455 | 455 |
456 Profile* profile = ProfileManager::GetLastUsedProfile(); | 456 Profile* profile = ProfileManager::GetLastUsedProfile(); |
457 if (!profile) { | 457 if (!profile) { |
458 // We should never be called before the profile has been created. | 458 // We should never be called before the profile has been created. |
459 NOTREACHED(); | 459 NOTREACHED(); |
460 return true; | 460 return true; |
461 } | 461 } |
462 | 462 |
463 ExtensionsStartupUtil ext_startup_util; | 463 extensions::StartupHelper extension_startup_helper; |
464 ext_startup_util.UninstallExtension(command_line, profile); | 464 extension_startup_helper.UninstallExtension(command_line, profile); |
465 return true; | 465 return true; |
466 } | 466 } |
467 | 467 |
468 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | 468 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
469 command_line, current_directory); | 469 command_line, current_directory); |
470 return true; | 470 return true; |
471 } | 471 } |
472 | 472 |
473 bool HasImportSwitch(const CommandLine& command_line) { | 473 bool HasImportSwitch(const CommandLine& command_line) { |
474 return (command_line.HasSwitch(switches::kImport) || | 474 return (command_line.HasSwitch(switches::kImport) || |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 982 |
983 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { | 983 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { |
984 return ShellIntegration::SetAsDefaultBrowser() ? | 984 return ShellIntegration::SetAsDefaultBrowser() ? |
985 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : | 985 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : |
986 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); | 986 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); |
987 } | 987 } |
988 | 988 |
989 // If the command line specifies --pack-extension, attempt the pack extension | 989 // If the command line specifies --pack-extension, attempt the pack extension |
990 // startup action and exit. | 990 // startup action and exit. |
991 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { | 991 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { |
992 ExtensionsStartupUtil extension_startup_util; | 992 extensions::StartupHelper extension_startup_helper; |
993 if (extension_startup_util.PackExtension(parsed_command_line())) | 993 if (extension_startup_helper.PackExtension(parsed_command_line())) |
994 return content::RESULT_CODE_NORMAL_EXIT; | 994 return content::RESULT_CODE_NORMAL_EXIT; |
995 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 995 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
996 } | 996 } |
997 | 997 |
998 bool pass_command_line = true; | 998 bool pass_command_line = true; |
999 | 999 |
1000 #if !defined(OS_MACOSX) | 1000 #if !defined(OS_MACOSX) |
1001 // In environments other than Mac OS X we support import of settings | 1001 // In environments other than Mac OS X we support import of settings |
1002 // from other browsers. In case this process is a short-lived "import" | 1002 // from other browsers. In case this process is a short-lived "import" |
1003 // process that another browser runs just to import the settings, we | 1003 // process that another browser runs just to import the settings, we |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 about_flags::RecordUMAStatistics(local_state_); | 1258 about_flags::RecordUMAStatistics(local_state_); |
1259 LanguageUsageMetrics::RecordAcceptLanguages( | 1259 LanguageUsageMetrics::RecordAcceptLanguages( |
1260 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 1260 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
1261 LanguageUsageMetrics::RecordApplicationLanguage( | 1261 LanguageUsageMetrics::RecordApplicationLanguage( |
1262 browser_process_->GetApplicationLocale()); | 1262 browser_process_->GetApplicationLocale()); |
1263 | 1263 |
1264 // The extension service may be available at this point. If the command line | 1264 // The extension service may be available at this point. If the command line |
1265 // specifies --uninstall-extension, attempt the uninstall extension startup | 1265 // specifies --uninstall-extension, attempt the uninstall extension startup |
1266 // action. | 1266 // action. |
1267 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { | 1267 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { |
1268 ExtensionsStartupUtil ext_startup_util; | 1268 extensions::StartupHelper extension_startup_helper; |
1269 if (ext_startup_util.UninstallExtension(parsed_command_line(), profile_)) | 1269 if (extension_startup_helper.UninstallExtension( |
| 1270 parsed_command_line(), profile_)) |
1270 return content::RESULT_CODE_NORMAL_EXIT; | 1271 return content::RESULT_CODE_NORMAL_EXIT; |
1271 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; | 1272 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; |
1272 } | 1273 } |
1273 | 1274 |
1274 // Start watching for hangs during startup. We disarm this hang detector when | 1275 // Start watching for hangs during startup. We disarm this hang detector when |
1275 // ThreadWatcher takes over or when browser is shutdown or when | 1276 // ThreadWatcher takes over or when browser is shutdown or when |
1276 // startup_watcher_ is deleted. | 1277 // startup_watcher_ is deleted. |
1277 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1278 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1278 | 1279 |
1279 // Start watching for a hang. | 1280 // Start watching for a hang. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1553 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1553 uma_name += "_XP"; | 1554 uma_name += "_XP"; |
1554 | 1555 |
1555 uma_name += "_PreRead_"; | 1556 uma_name += "_PreRead_"; |
1556 uma_name += pre_read_percentage; | 1557 uma_name += pre_read_percentage; |
1557 AddPreReadHistogramTime(uma_name.c_str(), time); | 1558 AddPreReadHistogramTime(uma_name.c_str(), time); |
1558 } | 1559 } |
1559 #endif | 1560 #endif |
1560 #endif | 1561 #endif |
1561 } | 1562 } |
OLD | NEW |