| 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" | |
| 51 #include "chrome/browser/chromeos/settings/cros_settings.h" | 50 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 52 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 51 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 53 #include "chrome/browser/extensions/extension_service.h" | 52 #include "chrome/browser/extensions/extension_service.h" |
| 54 #include "chrome/browser/first_run/first_run.h" | 53 #include "chrome/browser/first_run/first_run.h" |
| 55 #include "chrome/browser/google/google_util_chromeos.h" | 54 #include "chrome/browser/google/google_util_chromeos.h" |
| 56 #include "chrome/browser/managed_mode/managed_mode.h" | 55 #include "chrome/browser/managed_mode/managed_mode.h" |
| 57 #include "chrome/browser/net/chrome_url_request_context.h" | 56 #include "chrome/browser/net/chrome_url_request_context.h" |
| 58 #include "chrome/browser/net/preconnect.h" | 57 #include "chrome/browser/net/preconnect.h" |
| 59 #include "chrome/browser/policy/browser_policy_connector.h" | 58 #include "chrome/browser/policy/browser_policy_connector.h" |
| 60 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 59 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 session_restore_strategy_( | 124 session_restore_strategy_( |
| 126 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), | 125 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), |
| 127 url_request_context_getter_(NULL) { | 126 url_request_context_getter_(NULL) { |
| 128 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 127 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| 129 // During tests, the browser_process may not be initialized yet causing | 128 // During tests, the browser_process may not be initialized yet causing |
| 130 // this to fail. | 129 // this to fail. |
| 131 if (g_browser_process) { | 130 if (g_browser_process) { |
| 132 registrar_.Add( | 131 registrar_.Add( |
| 133 this, | 132 this, |
| 134 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | 133 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 135 content::Source<Profile>(ProfileHelper::GetSigninProfile())); | 134 content::Source<Profile>(ProfileManager::GetDefaultProfile())); |
| 136 } | 135 } |
| 137 } | 136 } |
| 138 | 137 |
| 139 virtual ~LoginUtilsImpl() { | 138 virtual ~LoginUtilsImpl() { |
| 140 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 139 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| 141 } | 140 } |
| 142 | 141 |
| 143 // LoginUtils implementation: | 142 // LoginUtils implementation: |
| 144 virtual void DoBrowserLaunch(Profile* profile, | 143 virtual void DoBrowserLaunch(Profile* profile, |
| 145 LoginDisplayHost* login_host) OVERRIDE; | 144 LoginDisplayHost* login_host) OVERRIDE; |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 public: | 793 public: |
| 795 WarmingObserver() | 794 WarmingObserver() |
| 796 : url_request_context_getter_(NULL) { | 795 : url_request_context_getter_(NULL) { |
| 797 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this); | 796 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this); |
| 798 // During tests, the browser_process may not be initialized yet causing | 797 // During tests, the browser_process may not be initialized yet causing |
| 799 // this to fail. | 798 // this to fail. |
| 800 if (g_browser_process) { | 799 if (g_browser_process) { |
| 801 registrar_.Add( | 800 registrar_.Add( |
| 802 this, | 801 this, |
| 803 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | 802 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 804 content::Source<Profile>(ProfileHelper::GetSigninProfile())); | 803 content::Source<Profile>(ProfileManager::GetDefaultProfile())); |
| 805 } | 804 } |
| 806 } | 805 } |
| 807 | 806 |
| 808 virtual ~WarmingObserver() {} | 807 virtual ~WarmingObserver() {} |
| 809 | 808 |
| 810 // If we're now connected, prewarm the auth url. | 809 // If we're now connected, prewarm the auth url. |
| 811 virtual void NetworkManagerChanged() OVERRIDE { | 810 virtual void NetworkManagerChanged() OVERRIDE { |
| 812 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); | 811 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); |
| 813 if (csh->IsConnected()) { | 812 if (csh->IsConnected()) { |
| 814 const int kConnectionsNeeded = 1; | 813 const int kConnectionsNeeded = 1; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 bool LoginUtils::IsWhitelisted(const std::string& username) { | 959 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 961 CrosSettings* cros_settings = CrosSettings::Get(); | 960 CrosSettings* cros_settings = CrosSettings::Get(); |
| 962 bool allow_new_user = false; | 961 bool allow_new_user = false; |
| 963 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 962 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 964 if (allow_new_user) | 963 if (allow_new_user) |
| 965 return true; | 964 return true; |
| 966 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 965 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 967 } | 966 } |
| 968 | 967 |
| 969 } // namespace chromeos | 968 } // namespace chromeos |
| OLD | NEW |