OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/hi_res_timer_manager.h" | 9 #include "app/hi_res_timer_manager.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #endif // defined(OS_WIN) | 123 #endif // defined(OS_WIN) |
124 | 124 |
125 #if defined(TOOLKIT_VIEWS) | 125 #if defined(TOOLKIT_VIEWS) |
126 #include "chrome/browser/views/chrome_views_delegate.h" | 126 #include "chrome/browser/views/chrome_views_delegate.h" |
127 #include "views/focus/accelerator_handler.h" | 127 #include "views/focus/accelerator_handler.h" |
128 #endif | 128 #endif |
129 | 129 |
130 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
131 #include "chrome/browser/chromeos/cros/cros_library.h" | 131 #include "chrome/browser/chromeos/cros/cros_library.h" |
132 #include "chrome/browser/chromeos/external_metrics.h" | 132 #include "chrome/browser/chromeos/external_metrics.h" |
| 133 #include "chrome/browser/chromeos/login/user_manager.h" |
133 #include "chrome/browser/views/browser_dialogs.h" | 134 #include "chrome/browser/views/browser_dialogs.h" |
134 #endif | 135 #endif |
135 | 136 |
136 namespace { | 137 namespace { |
137 | 138 |
138 // This function provides some ways to test crash and assertion handling | 139 // This function provides some ways to test crash and assertion handling |
139 // behavior of the program. | 140 // behavior of the program. |
140 void HandleTestParameters(const CommandLine& command_line) { | 141 void HandleTestParameters(const CommandLine& command_line) { |
141 // This parameter causes an assertion. | 142 // This parameter causes an assertion. |
142 if (command_line.HasSwitch(switches::kBrowserAssertTest)) { | 143 if (command_line.HasSwitch(switches::kBrowserAssertTest)) { |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 if (parsed_command_line.HasSwitch(switches::kHideIcons) || | 730 if (parsed_command_line.HasSwitch(switches::kHideIcons) || |
730 parsed_command_line.HasSwitch(switches::kShowIcons)) | 731 parsed_command_line.HasSwitch(switches::kShowIcons)) |
731 return HandleIconsCommands(parsed_command_line); | 732 return HandleIconsCommands(parsed_command_line); |
732 if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { | 733 if (parsed_command_line.HasSwitch(switches::kMakeDefaultBrowser)) { |
733 return ShellIntegration::SetAsDefaultBrowser() ? | 734 return ShellIntegration::SetAsDefaultBrowser() ? |
734 ResultCodes::NORMAL_EXIT : ResultCodes::SHELL_INTEGRATION_FAILED; | 735 ResultCodes::NORMAL_EXIT : ResultCodes::SHELL_INTEGRATION_FAILED; |
735 } | 736 } |
736 | 737 |
737 // Try to create/load the profile. | 738 // Try to create/load the profile. |
738 ProfileManager* profile_manager = browser_process->profile_manager(); | 739 ProfileManager* profile_manager = browser_process->profile_manager(); |
| 740 #if defined(OS_CHROMEOS) |
| 741 if (parsed_command_line.HasSwitch(switches::kLoginUser)) { |
| 742 std::string username = |
| 743 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 744 LOG(INFO) << "Relaunching browser for user: " << username; |
| 745 chromeos::UserManager::Get()->UserLoggedIn(username); |
| 746 } |
| 747 #endif |
| 748 |
739 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 749 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); |
740 | 750 |
741 #if defined(OS_WIN) | 751 #if defined(OS_WIN) |
742 if (!profile) { | 752 if (!profile) { |
743 // Ideally, we should be able to run w/o access to disk. For now, we | 753 // Ideally, we should be able to run w/o access to disk. For now, we |
744 // prompt the user to pick a different user-data-dir and restart chrome | 754 // prompt the user to pick a different user-data-dir and restart chrome |
745 // with the new dir. | 755 // with the new dir. |
746 // http://code.google.com/p/chromium/issues/detail?id=11510 | 756 // http://code.google.com/p/chromium/issues/detail?id=11510 |
747 user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir); | 757 user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir); |
748 if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { | 758 if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 if (metrics) | 1041 if (metrics) |
1032 metrics->Stop(); | 1042 metrics->Stop(); |
1033 | 1043 |
1034 // browser_shutdown takes care of deleting browser_process, so we need to | 1044 // browser_shutdown takes care of deleting browser_process, so we need to |
1035 // release it. | 1045 // release it. |
1036 browser_process.release(); | 1046 browser_process.release(); |
1037 browser_shutdown::Shutdown(); | 1047 browser_shutdown::Shutdown(); |
1038 | 1048 |
1039 return result_code; | 1049 return result_code; |
1040 } | 1050 } |
OLD | NEW |