| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 40 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 41 #include "chrome/browser/chromeos/login/login_display_host.h" | 41 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 42 #include "chrome/browser/chromeos/login/oauth_login_manager.h" | 42 #include "chrome/browser/chromeos/login/oauth_login_manager.h" |
| 43 #include "chrome/browser/chromeos/login/parallel_authenticator.h" | 43 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
| 44 #include "chrome/browser/chromeos/login/profile_auth_data.h" | 44 #include "chrome/browser/chromeos/login/profile_auth_data.h" |
| 45 #include "chrome/browser/chromeos/login/screen_locker.h" | 45 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 46 #include "chrome/browser/chromeos/login/user_manager.h" | 46 #include "chrome/browser/chromeos/login/user_manager.h" |
| 47 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" | 47 #include "chrome/browser/chromeos/net/connectivity_state_helper.h" |
| 48 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" | 48 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" |
| 49 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | 49 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
| 50 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 50 #include "chrome/browser/chromeos/settings/cros_settings.h" | 51 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 51 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 52 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 52 #include "chrome/browser/extensions/extension_service.h" | 53 #include "chrome/browser/extensions/extension_service.h" |
| 53 #include "chrome/browser/first_run/first_run.h" | 54 #include "chrome/browser/first_run/first_run.h" |
| 54 #include "chrome/browser/google/google_util_chromeos.h" | 55 #include "chrome/browser/google/google_util_chromeos.h" |
| 55 #include "chrome/browser/managed_mode/managed_mode.h" | 56 #include "chrome/browser/managed_mode/managed_mode.h" |
| 56 #include "chrome/browser/net/chrome_url_request_context.h" | 57 #include "chrome/browser/net/chrome_url_request_context.h" |
| 57 #include "chrome/browser/net/preconnect.h" | 58 #include "chrome/browser/net/preconnect.h" |
| 58 #include "chrome/browser/policy/browser_policy_connector.h" | 59 #include "chrome/browser/policy/browser_policy_connector.h" |
| 59 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 60 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 session_restore_strategy_( | 125 session_restore_strategy_( |
| 125 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), | 126 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), |
| 126 url_request_context_getter_(NULL) { | 127 url_request_context_getter_(NULL) { |
| 127 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 128 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| 128 // During tests, the browser_process may not be initialized yet causing | 129 // During tests, the browser_process may not be initialized yet causing |
| 129 // this to fail. | 130 // this to fail. |
| 130 if (g_browser_process) { | 131 if (g_browser_process) { |
| 131 registrar_.Add( | 132 registrar_.Add( |
| 132 this, | 133 this, |
| 133 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | 134 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 134 content::Source<Profile>(ProfileManager::GetDefaultProfile())); | 135 content::Source<Profile>(ProfileHelper::GetSigninProfile())); |
| 135 } | 136 } |
| 136 } | 137 } |
| 137 | 138 |
| 138 virtual ~LoginUtilsImpl() { | 139 virtual ~LoginUtilsImpl() { |
| 139 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 140 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| 140 } | 141 } |
| 141 | 142 |
| 142 // LoginUtils implementation: | 143 // LoginUtils implementation: |
| 143 virtual void DoBrowserLaunch(Profile* profile, | 144 virtual void DoBrowserLaunch(Profile* profile, |
| 144 LoginDisplayHost* login_host) OVERRIDE; | 145 LoginDisplayHost* login_host) OVERRIDE; |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 public: | 786 public: |
| 786 WarmingObserver() | 787 WarmingObserver() |
| 787 : url_request_context_getter_(NULL) { | 788 : url_request_context_getter_(NULL) { |
| 788 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this); | 789 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this); |
| 789 // During tests, the browser_process may not be initialized yet causing | 790 // During tests, the browser_process may not be initialized yet causing |
| 790 // this to fail. | 791 // this to fail. |
| 791 if (g_browser_process) { | 792 if (g_browser_process) { |
| 792 registrar_.Add( | 793 registrar_.Add( |
| 793 this, | 794 this, |
| 794 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | 795 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 795 content::Source<Profile>(ProfileManager::GetDefaultProfile())); | 796 content::Source<Profile>(ProfileHelper::GetSigninProfile())); |
| 796 } | 797 } |
| 797 } | 798 } |
| 798 | 799 |
| 799 virtual ~WarmingObserver() {} | 800 virtual ~WarmingObserver() {} |
| 800 | 801 |
| 801 // If we're now connected, prewarm the auth url. | 802 // If we're now connected, prewarm the auth url. |
| 802 virtual void NetworkManagerChanged() OVERRIDE { | 803 virtual void NetworkManagerChanged() OVERRIDE { |
| 803 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); | 804 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); |
| 804 if (csh->IsConnected()) { | 805 if (csh->IsConnected()) { |
| 805 const int kConnectionsNeeded = 1; | 806 const int kConnectionsNeeded = 1; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 bool LoginUtils::IsWhitelisted(const std::string& username) { | 952 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 952 CrosSettings* cros_settings = CrosSettings::Get(); | 953 CrosSettings* cros_settings = CrosSettings::Get(); |
| 953 bool allow_new_user = false; | 954 bool allow_new_user = false; |
| 954 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 955 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 955 if (allow_new_user) | 956 if (allow_new_user) |
| 956 return true; | 957 return true; |
| 957 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 958 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 958 } | 959 } |
| 959 | 960 |
| 960 } // namespace chromeos | 961 } // namespace chromeos |
| OLD | NEW |