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/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 Loading... |
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(); |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()->OnImportFinished(profile); |
| 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 Loading... |
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 } |
OLD | NEW |