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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { | 977 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { |
978 return ShellIntegration::SetAsDefaultBrowser() ? | 978 return ShellIntegration::SetAsDefaultBrowser() ? |
979 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : | 979 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : |
980 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); | 980 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); |
981 } | 981 } |
982 | 982 |
983 // If the command line specifies --pack-extension, attempt the pack extension | 983 // If the command line specifies --pack-extension, attempt the pack extension |
984 // startup action and exit. | 984 // startup action and exit. |
985 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { | 985 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { |
986 ExtensionsStartupUtil extension_startup_util; | 986 extensions::StartupHelper extension_startup_helper; |
987 if (extension_startup_util.PackExtension(parsed_command_line())) | 987 if (extension_startup_helper.PackExtension(parsed_command_line())) |
988 return content::RESULT_CODE_NORMAL_EXIT; | 988 return content::RESULT_CODE_NORMAL_EXIT; |
989 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; | 989 return chrome::RESULT_CODE_PACK_EXTENSION_ERROR; |
990 } | 990 } |
991 | 991 |
992 bool pass_command_line = true; | 992 bool pass_command_line = true; |
993 | 993 |
994 #if !defined(OS_MACOSX) | 994 #if !defined(OS_MACOSX) |
995 // In environments other than Mac OS X we support import of settings | 995 // In environments other than Mac OS X we support import of settings |
996 // from other browsers. In case this process is a short-lived "import" | 996 // from other browsers. In case this process is a short-lived "import" |
997 // process that another browser runs just to import the settings, we | 997 // process that another browser runs just to import the settings, we |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 about_flags::RecordUMAStatistics(local_state_); | 1250 about_flags::RecordUMAStatistics(local_state_); |
1251 LanguageUsageMetrics::RecordAcceptLanguages( | 1251 LanguageUsageMetrics::RecordAcceptLanguages( |
1252 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 1252 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
1253 LanguageUsageMetrics::RecordApplicationLanguage( | 1253 LanguageUsageMetrics::RecordApplicationLanguage( |
1254 browser_process_->GetApplicationLocale()); | 1254 browser_process_->GetApplicationLocale()); |
1255 | 1255 |
1256 // The extension service may be available at this point. If the command line | 1256 // The extension service may be available at this point. If the command line |
1257 // specifies --uninstall-extension, attempt the uninstall extension startup | 1257 // specifies --uninstall-extension, attempt the uninstall extension startup |
1258 // action. | 1258 // action. |
1259 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { | 1259 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { |
1260 ExtensionsStartupUtil ext_startup_util; | 1260 extensions::StartupHelper extension_startup_helper; |
1261 if (ext_startup_util.UninstallExtension(parsed_command_line(), profile_)) | 1261 if (extension_startup_helper.UninstallExtension( |
| 1262 parsed_command_line(), profile_)) |
1262 return content::RESULT_CODE_NORMAL_EXIT; | 1263 return content::RESULT_CODE_NORMAL_EXIT; |
1263 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; | 1264 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; |
1264 } | 1265 } |
1265 | 1266 |
1266 // Start watching for hangs during startup. We disarm this hang detector when | 1267 // Start watching for hangs during startup. We disarm this hang detector when |
1267 // ThreadWatcher takes over or when browser is shutdown or when | 1268 // ThreadWatcher takes over or when browser is shutdown or when |
1268 // startup_watcher_ is deleted. | 1269 // startup_watcher_ is deleted. |
1269 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1270 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1270 | 1271 |
1271 // Start watching for a hang. | 1272 // Start watching for a hang. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1525 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1525 uma_name += "_XP"; | 1526 uma_name += "_XP"; |
1526 | 1527 |
1527 uma_name += "_PreRead_"; | 1528 uma_name += "_PreRead_"; |
1528 uma_name += pre_read_percentage; | 1529 uma_name += pre_read_percentage; |
1529 AddPreReadHistogramTime(uma_name.c_str(), time); | 1530 AddPreReadHistogramTime(uma_name.c_str(), time); |
1530 } | 1531 } |
1531 #endif | 1532 #endif |
1532 #endif | 1533 #endif |
1533 } | 1534 } |
OLD | NEW |