| 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 <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "chrome/browser/chromeos/login/user_manager.h" | 52 #include "chrome/browser/chromeos/login/user_manager.h" |
| 53 #include "chrome/browser/chromeos/settings/cros_settings.h" | 53 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 54 #include "chrome/browser/extensions/extension_service.h" | 54 #include "chrome/browser/extensions/extension_service.h" |
| 55 #include "chrome/browser/first_run/first_run.h" | 55 #include "chrome/browser/first_run/first_run.h" |
| 56 #include "chrome/browser/google/google_util_chromeos.h" | 56 #include "chrome/browser/google/google_util_chromeos.h" |
| 57 #include "chrome/browser/lifetime/application_lifetime.h" | 57 #include "chrome/browser/lifetime/application_lifetime.h" |
| 58 #include "chrome/browser/pref_service_flags_storage.h" | 58 #include "chrome/browser/pref_service_flags_storage.h" |
| 59 #include "chrome/browser/profiles/profile.h" | 59 #include "chrome/browser/profiles/profile.h" |
| 60 #include "chrome/browser/profiles/profile_manager.h" | 60 #include "chrome/browser/profiles/profile_manager.h" |
| 61 #include "chrome/browser/rlz/rlz.h" | 61 #include "chrome/browser/rlz/rlz.h" |
| 62 #include "chrome/browser/signin/signin_manager.h" |
| 63 #include "chrome/browser/signin/signin_manager_factory.h" |
| 62 #include "chrome/browser/sync/profile_sync_service.h" | 64 #include "chrome/browser/sync/profile_sync_service.h" |
| 63 #include "chrome/browser/sync/profile_sync_service_factory.h" | 65 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 64 #include "chrome/browser/ui/app_list/start_page_service.h" | 66 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 65 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 67 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 66 #include "chrome/common/chrome_paths.h" | 68 #include "chrome/common/chrome_paths.h" |
| 67 #include "chrome/common/chrome_switches.h" | 69 #include "chrome/common/chrome_switches.h" |
| 68 #include "chrome/common/logging_chrome.h" | 70 #include "chrome/common/logging_chrome.h" |
| 69 #include "chrome/common/pref_names.h" | 71 #include "chrome/common/pref_names.h" |
| 70 #include "chromeos/chromeos_switches.h" | 72 #include "chromeos/chromeos_switches.h" |
| 71 #include "chromeos/cryptohome/cryptohome_util.h" | 73 #include "chromeos/cryptohome/cryptohome_util.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // http://crbug.com/276163 | 453 // http://crbug.com/276163 |
| 452 if (managed_user_sync_id.empty()) | 454 if (managed_user_sync_id.empty()) |
| 453 managed_user_sync_id = "DUMMY_ID"; | 455 managed_user_sync_id = "DUMMY_ID"; |
| 454 | 456 |
| 455 user_profile->GetPrefs()->SetString(prefs::kManagedUserId, | 457 user_profile->GetPrefs()->SetString(prefs::kManagedUserId, |
| 456 managed_user_sync_id); | 458 managed_user_sync_id); |
| 457 } else { | 459 } else { |
| 458 // Make sure that the google service username is properly set (we do this | 460 // Make sure that the google service username is properly set (we do this |
| 459 // on every sign in, not just the first login, to deal with existing | 461 // on every sign in, not just the first login, to deal with existing |
| 460 // profiles that might not have it set yet). | 462 // profiles that might not have it set yet). |
| 461 StringPrefMember google_services_username; | 463 SigninManagerBase* signin_manager = |
| 462 google_services_username.Init(prefs::kGoogleServicesUsername, | 464 SigninManagerFactory::GetForProfile(user_profile); |
| 463 user_profile->GetPrefs()); | 465 signin_manager->SetAuthenticatedUsername(user_id); |
| 464 google_services_username.SetValue(user_id); | |
| 465 } | 466 } |
| 466 } | 467 } |
| 467 | 468 |
| 468 void LoginUtilsImpl::InitSessionRestoreStrategy() { | 469 void LoginUtilsImpl::InitSessionRestoreStrategy() { |
| 469 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 470 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 470 bool in_app_mode = chrome::IsRunningInForcedAppMode(); | 471 bool in_app_mode = chrome::IsRunningInForcedAppMode(); |
| 471 | 472 |
| 472 // Are we in kiosk app mode? | 473 // Are we in kiosk app mode? |
| 473 if (in_app_mode) { | 474 if (in_app_mode) { |
| 474 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { | 475 if (command_line->HasSwitch(::switches::kAppModeOAuth2Token)) { |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 CrosSettings* cros_settings = CrosSettings::Get(); | 945 CrosSettings* cros_settings = CrosSettings::Get(); |
| 945 bool allow_new_user = false; | 946 bool allow_new_user = false; |
| 946 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 947 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 947 if (allow_new_user) | 948 if (allow_new_user) |
| 948 return true; | 949 return true; |
| 949 return cros_settings->FindEmailInList( | 950 return cros_settings->FindEmailInList( |
| 950 kAccountsPrefUsers, username, wildcard_match); | 951 kAccountsPrefUsers, username, wildcard_match); |
| 951 } | 952 } |
| 952 | 953 |
| 953 } // namespace chromeos | 954 } // namespace chromeos |
| OLD | NEW |