Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/browser_main.cc

Issue 7717025: Do not initialize event routers in the Profile Import process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: add process restriction from first CL Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser_main.h" 5 #include "chrome/browser/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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 std::string username = 1702 std::string username =
1703 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); 1703 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser);
1704 VLOG(1) << "Relaunching browser for user: " << username; 1704 VLOG(1) << "Relaunching browser for user: " << username;
1705 chromeos::UserManager::Get()->UserLoggedIn(username); 1705 chromeos::UserManager::Get()->UserLoggedIn(username);
1706 1706
1707 // Redirects Chrome logging to the user data dir. 1707 // Redirects Chrome logging to the user data dir.
1708 logging::RedirectChromeLogging(parsed_command_line); 1708 logging::RedirectChromeLogging(parsed_command_line);
1709 } 1709 }
1710 #endif 1710 #endif
1711 1711
1712 if (is_first_run) {
1713 // Warn the ProfileManager that an import process will run, possibly
1714 // locking the WebDataService directory of the next Profile created.
1715 g_browser_process->profile_manager()->SetWillImport(true, NULL);
1716 }
1717
1712 Profile* profile = CreateProfile(parameters, user_data_dir, 1718 Profile* profile = CreateProfile(parameters, user_data_dir,
1713 parsed_command_line); 1719 parsed_command_line);
1714 if (!profile) 1720 if (!profile)
1715 return content::RESULT_CODE_NORMAL_EXIT; 1721 return content::RESULT_CODE_NORMAL_EXIT;
1716 1722
1717 // Post-profile init --------------------------------------------------------- 1723 // Post-profile init ---------------------------------------------------------
1718 1724
1719 #if defined(OS_CHROMEOS) 1725 #if defined(OS_CHROMEOS)
1720 // Handling the user cloud policy initialization for case 2 mentioned above. 1726 // Handling the user cloud policy initialization for case 2 mentioned above.
1721 // We do this after the profile creation since we need the TokenService. 1727 // We do this after the profile creation since we need the TokenService.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 } 1791 }
1786 #endif 1792 #endif
1787 1793
1788 // Show the First Run UI if this is the first time Chrome has been run on 1794 // Show the First Run UI if this is the first time Chrome has been run on
1789 // this computer, or we're being compelled to do so by a command line flag. 1795 // this computer, or we're being compelled to do so by a command line flag.
1790 // Note that this be done _after_ the PrefService is initialized and all 1796 // Note that this be done _after_ the PrefService is initialized and all
1791 // preferences are registered, since some of the code that the importer 1797 // preferences are registered, since some of the code that the importer
1792 // touches reads preferences. 1798 // touches reads preferences.
1793 if (is_first_run) { 1799 if (is_first_run) {
1794 if (!first_run_ui_bypass) { 1800 if (!first_run_ui_bypass) {
1795 FirstRun::AutoImport(profile, 1801 FirstRun::AutoImport(profile,
Yoyo Zhou 2011/08/25 16:34:03 This returns after the import is finished (or it's
Miranda Callahan 2011/08/26 08:31:32 Yes it does; the rest of the startup process conti
1796 master_prefs.homepage_defined, 1802 master_prefs.homepage_defined,
1797 master_prefs.do_import_items, 1803 master_prefs.do_import_items,
1798 master_prefs.dont_import_items, 1804 master_prefs.dont_import_items,
1799 master_prefs.run_search_engine_experiment, 1805 master_prefs.run_search_engine_experiment,
1800 master_prefs.randomize_search_engine_experiment, 1806 master_prefs.randomize_search_engine_experiment,
1801 master_prefs.make_chrome_default, 1807 master_prefs.make_chrome_default,
1802 &process_singleton); 1808 &process_singleton);
1803 #if defined(OS_POSIX) 1809 #if defined(OS_POSIX)
1804 // On Windows, the download is tagged with enable/disable stats so there 1810 // On Windows, the download is tagged with enable/disable stats so there
1805 // is no need for this code. 1811 // is no need for this code.
1806 1812
1807 // If stats reporting was turned on by the first run dialog then toggle 1813 // If stats reporting was turned on by the first run dialog then toggle
1808 // the pref. 1814 // the pref.
1809 if (GoogleUpdateSettings::GetCollectStatsConsent()) 1815 if (GoogleUpdateSettings::GetCollectStatsConsent())
1810 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); 1816 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true);
1811 #endif // OS_POSIX 1817 #endif // OS_POSIX
1812 } // if (!first_run_ui_bypass) 1818 } // if (!first_run_ui_bypass)
1813 1819
1814 Browser::SetNewHomePagePrefs(user_prefs); 1820 Browser::SetNewHomePagePrefs(user_prefs);
1815 } 1821 g_browser_process->profile_manager()->SetWillImport(false, profile);
Yoyo Zhou 2011/08/25 16:34:03 Maybe this function should have a different name -
Miranda Callahan 2011/08/26 08:31:32 Yeah, I wasn't really happy with this either. I'll
1822 } // if (is_first_run)
1816 1823
1817 // Sets things up so that if we crash from this point on, a dialog will 1824 // Sets things up so that if we crash from this point on, a dialog will
1818 // popup asking the user to restart chrome. It is done this late to avoid 1825 // popup asking the user to restart chrome. It is done this late to avoid
1819 // testing against a bunch of special cases that are taken care early on. 1826 // testing against a bunch of special cases that are taken care early on.
1820 PrepareRestartOnCrashEnviroment(parsed_command_line); 1827 PrepareRestartOnCrashEnviroment(parsed_command_line);
1821 1828
1822 #if defined(OS_WIN) 1829 #if defined(OS_WIN)
1823 // Registers Chrome with the Windows Restart Manager, which will restore the 1830 // Registers Chrome with the Windows Restart Manager, which will restore the
1824 // Chrome session when the computer is restarted after a system update. 1831 // Chrome session when the computer is restarted after a system update.
1825 // This could be run as late as WM_QUERYENDSESSION for system update reboots, 1832 // This could be run as late as WM_QUERYENDSESSION for system update reboots,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 #if defined(OS_CHROMEOS) 2146 #if defined(OS_CHROMEOS)
2140 // To be precise, logout (browser shutdown) is not yet done, but the 2147 // To be precise, logout (browser shutdown) is not yet done, but the
2141 // remaining work is negligible, hence we say LogoutDone here. 2148 // remaining work is negligible, hence we say LogoutDone here.
2142 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 2149 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
2143 false); 2150 false);
2144 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 2151 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
2145 #endif 2152 #endif
2146 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 2153 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
2147 return result_code; 2154 return result_code;
2148 } 2155 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698