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/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/path_service.h" | 24 #include "base/path_service.h" |
25 #include "base/prefs/pref_service.h" | 25 #include "base/prefs/pref_service.h" |
26 #include "base/strings/string_number_conversions.h" | 26 #include "base/strings/string_number_conversions.h" |
27 #include "base/strings/string_split.h" | 27 #include "base/strings/string_split.h" |
28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
29 #include "base/threading/thread_restrictions.h" | 29 #include "base/threading/thread_restrictions.h" |
30 #include "chrome/browser/app_mode/app_mode_utils.h" | 30 #include "chrome/browser/app_mode/app_mode_utils.h" |
31 #include "chrome/browser/auto_launch_trial.h" | 31 #include "chrome/browser/auto_launch_trial.h" |
32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/chrome_notification_types.h" | 33 #include "chrome/browser/chrome_notification_types.h" |
| 34 #include "chrome/browser/component_updater/recovery_component_installer.h" |
34 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 35 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
35 #include "chrome/browser/extensions/startup_helper.h" | 36 #include "chrome/browser/extensions/startup_helper.h" |
36 #include "chrome/browser/extensions/unpacked_installer.h" | 37 #include "chrome/browser/extensions/unpacked_installer.h" |
37 #include "chrome/browser/first_run/first_run.h" | 38 #include "chrome/browser/first_run/first_run.h" |
38 #include "chrome/browser/notifications/desktop_notification_service.h" | 39 #include "chrome/browser/notifications/desktop_notification_service.h" |
39 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 40 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
40 #include "chrome/browser/prefs/session_startup_pref.h" | 41 #include "chrome/browser/prefs/session_startup_pref.h" |
41 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
42 #include "chrome/browser/profiles/profile_manager.h" | 43 #include "chrome/browser/profiles/profile_manager.h" |
43 #include "chrome/browser/profiles/profiles_state.h" | 44 #include "chrome/browser/profiles/profiles_state.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 } | 501 } |
501 | 502 |
502 if (command_line.HasSwitch(switches::kInstallFromWebstore)) { | 503 if (command_line.HasSwitch(switches::kInstallFromWebstore)) { |
503 extensions::StartupHelper helper; | 504 extensions::StartupHelper helper; |
504 helper.InstallFromWebstore(command_line, last_used_profile); | 505 helper.InstallFromWebstore(command_line, last_used_profile); |
505 // Nothing more needs to be done, so return false to stop launching and | 506 // Nothing more needs to be done, so return false to stop launching and |
506 // quit. | 507 // quit. |
507 return false; | 508 return false; |
508 } | 509 } |
509 | 510 |
| 511 if (command_line.HasSwitch(switches::kInstallRecoveryComponent)) { |
| 512 std::string recovery_version = command_line.GetSwitchValueASCII( |
| 513 switches::kInstallRecoveryComponent); |
| 514 silent_launch = true; |
| 515 component_updater::InstallRecoveryComponentElevated(recovery_version); |
| 516 // Nothing more to do after recovery, return false to stop launching and |
| 517 // quit. |
| 518 return false; |
| 519 } |
| 520 |
510 if (command_line.HasSwitch(switches::kValidateCrx)) { | 521 if (command_line.HasSwitch(switches::kValidateCrx)) { |
511 if (!process_startup) { | 522 if (!process_startup) { |
512 LOG(ERROR) << "chrome is already running; you must close all running " | 523 LOG(ERROR) << "chrome is already running; you must close all running " |
513 << "instances before running with the --" | 524 << "instances before running with the --" |
514 << switches::kValidateCrx << " flag"; | 525 << switches::kValidateCrx << " flag"; |
515 return false; | 526 return false; |
516 } | 527 } |
517 extensions::StartupHelper helper; | 528 extensions::StartupHelper helper; |
518 std::string message; | 529 std::string message; |
519 std::string error; | 530 std::string error; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 746 } |
736 | 747 |
737 if (command_line.HasSwitch(switches::kProfileDirectory)) { | 748 if (command_line.HasSwitch(switches::kProfileDirectory)) { |
738 return user_data_dir.Append( | 749 return user_data_dir.Append( |
739 command_line.GetSwitchValuePath(switches::kProfileDirectory)); | 750 command_line.GetSwitchValuePath(switches::kProfileDirectory)); |
740 } | 751 } |
741 | 752 |
742 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 753 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
743 user_data_dir); | 754 user_data_dir); |
744 } | 755 } |
OLD | NEW |