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 30 matching lines...) Expand all Loading... | |
41 #include "chrome/browser/chromeos/login/screen_locker.h" | 41 #include "chrome/browser/chromeos/login/screen_locker.h" |
42 #include "chrome/browser/chromeos/login/user_manager.h" | 42 #include "chrome/browser/chromeos/login/user_manager.h" |
43 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" | 43 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" |
44 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" | 44 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" |
45 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 45 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
46 #include "chrome/browser/chromeos/settings/cros_settings.h" | 46 #include "chrome/browser/chromeos/settings/cros_settings.h" |
47 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 47 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
48 #include "chrome/browser/extensions/extension_service.h" | 48 #include "chrome/browser/extensions/extension_service.h" |
49 #include "chrome/browser/first_run/first_run.h" | 49 #include "chrome/browser/first_run/first_run.h" |
50 #include "chrome/browser/google/google_util_chromeos.h" | 50 #include "chrome/browser/google/google_util_chromeos.h" |
51 #include "chrome/browser/lifetime/application_lifetime.h" | |
51 #include "chrome/browser/managed_mode/managed_mode.h" | 52 #include "chrome/browser/managed_mode/managed_mode.h" |
52 #include "chrome/browser/net/chrome_url_request_context.h" | 53 #include "chrome/browser/net/chrome_url_request_context.h" |
53 #include "chrome/browser/net/preconnect.h" | 54 #include "chrome/browser/net/preconnect.h" |
55 #include "chrome/browser/pref_service_flags_storage.h" | |
54 #include "chrome/browser/profiles/profile.h" | 56 #include "chrome/browser/profiles/profile.h" |
55 #include "chrome/browser/profiles/profile_manager.h" | 57 #include "chrome/browser/profiles/profile_manager.h" |
56 #include "chrome/browser/rlz/rlz.h" | 58 #include "chrome/browser/rlz/rlz.h" |
57 #include "chrome/browser/signin/signin_manager.h" | 59 #include "chrome/browser/signin/signin_manager.h" |
58 #include "chrome/browser/signin/signin_manager_factory.h" | 60 #include "chrome/browser/signin/signin_manager_factory.h" |
59 #include "chrome/browser/signin/token_service.h" | 61 #include "chrome/browser/signin/token_service.h" |
60 #include "chrome/browser/signin/token_service_factory.h" | 62 #include "chrome/browser/signin/token_service_factory.h" |
61 #include "chrome/browser/sync/profile_sync_service.h" | 63 #include "chrome/browser/sync/profile_sync_service.h" |
62 #include "chrome/browser/sync/profile_sync_service_factory.h" | 64 #include "chrome/browser/sync/profile_sync_service_factory.h" |
63 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 65 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 scoped_ptr<LoginUtils> ptr_; | 275 scoped_ptr<LoginUtils> ptr_; |
274 | 276 |
275 DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); | 277 DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); |
276 }; | 278 }; |
277 | 279 |
278 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, | 280 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, |
279 LoginDisplayHost* login_host) { | 281 LoginDisplayHost* login_host) { |
280 if (browser_shutdown::IsTryingToQuit()) | 282 if (browser_shutdown::IsTryingToQuit()) |
281 return; | 283 return; |
282 | 284 |
285 CommandLine user_flags(CommandLine::NO_PROGRAM); | |
286 about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs()); | |
287 about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags); | |
288 if (!about_flags::AreSwitchesIdenticalToCurrentCommandLine( | |
289 user_flags, *CommandLine::ForCurrentProcess())) { | |
290 CommandLine::StringVector flags; | |
291 // argv[0] is the program name |CommandLine::NO_PROGRAM|. | |
292 flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end()); | |
293 VLOG(1) << "Restarting to apply per-session flags..."; | |
294 DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( | |
Dmitry Polukhin
2013/06/18 13:12:41
This changes broke locally managed user creation f
| |
295 UserManager::Get()->GetActiveUser()->email(), flags); | |
296 chrome::ExitCleanly(); | |
297 return; | |
298 } | |
299 | |
283 if (!UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) { | 300 if (!UserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) { |
284 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile); | 301 UserManager::Get()->GetCurrentUserFlow()->LaunchExtraSteps(profile); |
285 return; | 302 return; |
286 } | 303 } |
287 | 304 |
288 if (login_host) { | 305 if (login_host) { |
289 login_host->SetStatusAreaVisible(true); | 306 login_host->SetStatusAreaVisible(true); |
290 login_host->BeforeSessionStart(); | 307 login_host->BeforeSessionStart(); |
291 } | 308 } |
292 | 309 |
293 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false); | 310 BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false); |
294 | 311 |
295 VLOG(1) << "Launching browser..."; | 312 VLOG(1) << "Launching browser..."; |
296 StartupBrowserCreator browser_creator; | 313 StartupBrowserCreator browser_creator; |
297 int return_code; | 314 int return_code; |
298 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 315 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
299 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 316 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
300 | 317 |
301 // TODO(pastarmovj): Restart the browser and apply any flags set by the user. | |
302 // See: http://crosbug.com/39249 | |
303 | |
304 browser_creator.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 318 browser_creator.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
305 profile, | 319 profile, |
306 base::FilePath(), | 320 base::FilePath(), |
307 chrome::startup::IS_PROCESS_STARTUP, | 321 chrome::startup::IS_PROCESS_STARTUP, |
308 first_run, | 322 first_run, |
309 &return_code); | 323 &return_code); |
310 | 324 |
311 // Mark login host for deletion after browser starts. This | 325 // Mark login host for deletion after browser starts. This |
312 // guarantees that the message loop will be referenced by the | 326 // guarantees that the message loop will be referenced by the |
313 // browser before it is dereferenced by the login host. | 327 // browser before it is dereferenced by the login host. |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 bool LoginUtils::IsWhitelisted(const std::string& username) { | 932 bool LoginUtils::IsWhitelisted(const std::string& username) { |
919 CrosSettings* cros_settings = CrosSettings::Get(); | 933 CrosSettings* cros_settings = CrosSettings::Get(); |
920 bool allow_new_user = false; | 934 bool allow_new_user = false; |
921 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 935 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
922 if (allow_new_user) | 936 if (allow_new_user) |
923 return true; | 937 return true; |
924 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 938 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
925 } | 939 } |
926 | 940 |
927 } // namespace chromeos | 941 } // namespace chromeos |
OLD | NEW |