Chromium Code Reviews| 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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/chromeos/chromeos_version.h" | 10 #include "base/chromeos/chromeos_version.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, | 280 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, |
| 281 LoginDisplayHost* login_host) { | 281 LoginDisplayHost* login_host) { |
| 282 if (browser_shutdown::IsTryingToQuit()) | 282 if (browser_shutdown::IsTryingToQuit()) |
| 283 return; | 283 return; |
| 284 | 284 |
| 285 CommandLine user_flags(CommandLine::NO_PROGRAM); | 285 CommandLine user_flags(CommandLine::NO_PROGRAM); |
| 286 about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs()); | 286 about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs()); |
| 287 about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags); | 287 about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags); |
| 288 if (!about_flags::AreSwitchesIdenticalToCurrentCommandLine( | 288 |
| 289 bool should_launch_browser = | |
| 290 UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser(); | |
| 291 | |
| 292 if (should_launch_browser && | |
| 293 !about_flags::AreSwitchesIdenticalToCurrentCommandLine( | |
| 289 user_flags, *CommandLine::ForCurrentProcess())) { | 294 user_flags, *CommandLine::ForCurrentProcess())) { |
| 290 CommandLine::StringVector flags; | 295 CommandLine::StringVector flags; |
| 291 // argv[0] is the program name |CommandLine::NO_PROGRAM|. | 296 // argv[0] is the program name |CommandLine::NO_PROGRAM|. |
| 292 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); | 297 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); |
| 293 VLOG(1) << "Restarting to apply per-session flags..."; | 298 VLOG(1) << "Restarting to apply per-session flags..."; |
| 294 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( | 299 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( |
| 295 UserManager::Get()->GetActiveUser()->email(), flags); | 300 UserManager::Get()->GetActiveUser()->email(), flags); |
| 296 chrome::ExitCleanly(); | 301 chrome::ExitCleanly(); |
| 297 return; | 302 return; |
| 298 } | 303 } |
| 299 | 304 |
| 300 if (!UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) { | 305 if (!should_launch_browser) { |
|
pastarmovj
2013/06/18 18:15:36
Hey why not move the if above below this if - then
Dmitry Polukhin
2013/06/18 18:40:02
Done.
| |
| 301 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile); | 306 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile); |
| 302 return; | 307 return; |
| 303 } | 308 } |
| 304 | 309 |
| 305 if (login_host) { | 310 if (login_host) { |
| 306 login_host->SetStatusAreaVisible(true); | 311 login_host->SetStatusAreaVisible(true); |
| 307 login_host->BeforeSessionStart(); | 312 login_host->BeforeSessionStart(); |
| 308 } | 313 } |
| 309 | 314 |
| 310 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false); | 315 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false); |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 bool LoginUtils::IsWhitelisted(const std::string& username) { | 937 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 933 CrosSettings* cros_settings = CrosSettings::Get(); | 938 CrosSettings* cros_settings = CrosSettings::Get(); |
| 934 bool allow_new_user = false; | 939 bool allow_new_user = false; |
| 935 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 940 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 936 if (allow_new_user) | 941 if (allow_new_user) |
| 937 return true; | 942 return true; |
| 938 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 943 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 939 } | 944 } |
| 940 | 945 |
| 941 } // namespace chromeos | 946 } // namespace chromeos |
| OLD | NEW |