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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/singleton.h" | 14 #include "base/singleton.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "base/threading/thread_restrictions.h" |
18 #include "base/time.h" | 19 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_thread.h" | 22 #include "chrome/browser/browser_thread.h" |
22 #include "chrome/browser/chromeos/boot_times_loader.h" | 23 #include "chrome/browser/chromeos/boot_times_loader.h" |
23 #include "chrome/browser/chromeos/cros/login_library.h" | 24 #include "chrome/browser/chromeos/cros/login_library.h" |
24 #include "chrome/browser/chromeos/cros/network_library.h" | 25 #include "chrome/browser/chromeos/cros/network_library.h" |
25 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 26 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
26 #include "chrome/browser/chromeos/login/background_view.h" | 27 #include "chrome/browser/chromeos/login/background_view.h" |
27 #include "chrome/browser/chromeos/login/cookie_fetcher.h" | 28 #include "chrome/browser/chromeos/login/cookie_fetcher.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 215 |
215 // Now get the new profile. | 216 // Now get the new profile. |
216 FilePath user_data_dir; | 217 FilePath user_data_dir; |
217 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 218 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
218 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 219 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
219 | 220 |
220 // Switch log file as soon as possible. | 221 // Switch log file as soon as possible. |
221 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess())); | 222 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess())); |
222 btl->AddLoginTimeMarker("LoggingRedirected", false); | 223 btl->AddLoginTimeMarker("LoggingRedirected", false); |
223 | 224 |
224 // The default profile will have been changed because the ProfileManager | 225 Profile* profile = NULL; |
225 // will process the notification that the UserManager sends out. | 226 { |
226 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 227 // Loading user profile causes us to do blocking IO on UI thread. |
| 228 // Temporarily allow it until we fix http://crosbug.com/11104 |
| 229 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 230 // The default profile will have been changed because the ProfileManager |
| 231 // will process the notification that the UserManager sends out. |
| 232 profile = profile_manager->GetDefaultProfile(user_data_dir); |
| 233 } |
227 btl->AddLoginTimeMarker("UserProfileGotten", false); | 234 btl->AddLoginTimeMarker("UserProfileGotten", false); |
228 | 235 |
229 // Change the proxy configuration service of the default request context to | 236 // Change the proxy configuration service of the default request context to |
230 // use the preference configuration from the logged-in profile. This ensures | 237 // use the preference configuration from the logged-in profile. This ensures |
231 // that requests done through the default context use the proxy configuration | 238 // that requests done through the default context use the proxy configuration |
232 // provided by configuration policy. | 239 // provided by configuration policy. |
233 // | 240 // |
234 // Note: Many of the clients of the default request context should probably be | 241 // Note: Many of the clients of the default request context should probably be |
235 // fixed to use the request context of the profile they are associated with. | 242 // fixed to use the request context of the profile they are associated with. |
236 // This includes preconnect, autofill, metrics service to only name a few; | 243 // This includes preconnect, autofill, metrics service to only name a few; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 BrowserInit browser_init; | 586 BrowserInit browser_init; |
580 int return_code; | 587 int return_code; |
581 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 588 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
582 profile, | 589 profile, |
583 FilePath(), | 590 FilePath(), |
584 true, | 591 true, |
585 &return_code); | 592 &return_code); |
586 } | 593 } |
587 | 594 |
588 } // namespace chromeos | 595 } // namespace chromeos |
OLD | NEW |