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 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 // in ChromeMain() got destructed when the function returned. | 707 // in ChromeMain() got destructed when the function returned. |
708 base::AtExitManager exit_manager; | 708 base::AtExitManager exit_manager; |
709 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 709 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
710 } | 710 } |
711 #endif | 711 #endif |
712 | 712 |
713 // content::BrowserMainParts implementation ------------------------------------ | 713 // content::BrowserMainParts implementation ------------------------------------ |
714 | 714 |
715 void ChromeBrowserMainParts::PreEarlyInitialization() { | 715 void ChromeBrowserMainParts::PreEarlyInitialization() { |
716 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreEarlyInitialization"); | 716 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreEarlyInitialization"); |
| 717 ProfileManager::SetAllowGetDefaultProfile(false); |
717 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 718 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
718 chrome_extra_parts_[i]->PreEarlyInitialization(); | 719 chrome_extra_parts_[i]->PreEarlyInitialization(); |
719 } | 720 } |
720 | 721 |
721 void ChromeBrowserMainParts::PostEarlyInitialization() { | 722 void ChromeBrowserMainParts::PostEarlyInitialization() { |
722 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostEarlyInitialization"); | 723 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostEarlyInitialization"); |
723 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 724 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
724 chrome_extra_parts_[i]->PostEarlyInitialization(); | 725 chrome_extra_parts_[i]->PostEarlyInitialization(); |
725 } | 726 } |
726 | 727 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 } | 1257 } |
1257 | 1258 |
1258 // Profile creation ---------------------------------------------------------- | 1259 // Profile creation ---------------------------------------------------------- |
1259 | 1260 |
1260 if (do_first_run_tasks_) { | 1261 if (do_first_run_tasks_) { |
1261 // Warn the ProfileManager that an import process will run, possibly | 1262 // Warn the ProfileManager that an import process will run, possibly |
1262 // locking the WebDataService directory of the next Profile created. | 1263 // locking the WebDataService directory of the next Profile created. |
1263 browser_process_->profile_manager()->SetWillImport(); | 1264 browser_process_->profile_manager()->SetWillImport(); |
1264 } | 1265 } |
1265 | 1266 |
| 1267 // Called before CreateProfile because creating the profile can trigger |
| 1268 // calls to GetDefaultProfile(). |
| 1269 ProfileManager::SetAllowGetDefaultProfile(true); |
| 1270 |
1266 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); | 1271 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); |
1267 if (!profile_) | 1272 if (!profile_) |
1268 return content::RESULT_CODE_NORMAL_EXIT; | 1273 return content::RESULT_CODE_NORMAL_EXIT; |
1269 | 1274 |
1270 #if defined(ENABLE_BACKGROUND) | 1275 #if defined(ENABLE_BACKGROUND) |
1271 // Autoload any profiles which are running background apps. | 1276 // Autoload any profiles which are running background apps. |
1272 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. | 1277 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. |
1273 browser_process_->profile_manager()->AutoloadProfiles(); | 1278 browser_process_->profile_manager()->AutoloadProfiles(); |
1274 #endif | 1279 #endif |
1275 // Post-profile init --------------------------------------------------------- | 1280 // Post-profile init --------------------------------------------------------- |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1814 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1810 uma_name += "_XP"; | 1815 uma_name += "_XP"; |
1811 | 1816 |
1812 uma_name += "_PreRead_"; | 1817 uma_name += "_PreRead_"; |
1813 uma_name += pre_read_percentage; | 1818 uma_name += pre_read_percentage; |
1814 AddPreReadHistogramTime(uma_name.c_str(), time); | 1819 AddPreReadHistogramTime(uma_name.c_str(), time); |
1815 } | 1820 } |
1816 #endif | 1821 #endif |
1817 #endif | 1822 #endif |
1818 } | 1823 } |
OLD | NEW |