Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 13633003: Part of multiprofile implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 session_restore_strategy_( 124 session_restore_strategy_(
125 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN), 125 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN),
126 url_request_context_getter_(NULL) { 126 url_request_context_getter_(NULL) {
127 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 127 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
128 // During tests, the browser_process may not be initialized yet causing 128 // During tests, the browser_process may not be initialized yet causing
129 // this to fail. 129 // this to fail.
130 if (g_browser_process) { 130 if (g_browser_process) {
131 registrar_.Add( 131 registrar_.Add(
132 this, 132 this,
133 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, 133 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
134 content::Source<Profile>(ProfileManager::GetDefaultProfile())); 134 content::Source<Profile>(ProfileManager::GetSigninProfile()));
135 } 135 }
136 } 136 }
137 137
138 virtual ~LoginUtilsImpl() { 138 virtual ~LoginUtilsImpl() {
139 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 139 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
140 } 140 }
141 141
142 // LoginUtils implementation: 142 // LoginUtils implementation:
143 virtual void DoBrowserLaunch(Profile* profile, 143 virtual void DoBrowserLaunch(Profile* profile,
144 LoginDisplayHost* login_host) OVERRIDE; 144 LoginDisplayHost* login_host) OVERRIDE;
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 public: 781 public:
782 WarmingObserver() 782 WarmingObserver()
783 : url_request_context_getter_(NULL) { 783 : url_request_context_getter_(NULL) {
784 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this); 784 ConnectivityStateHelper::Get()->AddNetworkManagerObserver(this);
785 // During tests, the browser_process may not be initialized yet causing 785 // During tests, the browser_process may not be initialized yet causing
786 // this to fail. 786 // this to fail.
787 if (g_browser_process) { 787 if (g_browser_process) {
788 registrar_.Add( 788 registrar_.Add(
789 this, 789 this,
790 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, 790 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
791 content::Source<Profile>(ProfileManager::GetDefaultProfile())); 791 content::Source<Profile>(ProfileManager::GetSigninProfile()));
792 } 792 }
793 } 793 }
794 794
795 virtual ~WarmingObserver() {} 795 virtual ~WarmingObserver() {}
796 796
797 // If we're now connected, prewarm the auth url. 797 // If we're now connected, prewarm the auth url.
798 virtual void NetworkManagerChanged() OVERRIDE { 798 virtual void NetworkManagerChanged() OVERRIDE {
799 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get(); 799 ConnectivityStateHelper* csh = ConnectivityStateHelper::Get();
800 if (csh->IsConnected()) { 800 if (csh->IsConnected()) {
801 const int kConnectionsNeeded = 1; 801 const int kConnectionsNeeded = 1;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 bool LoginUtils::IsWhitelisted(const std::string& username) { 947 bool LoginUtils::IsWhitelisted(const std::string& username) {
948 CrosSettings* cros_settings = CrosSettings::Get(); 948 CrosSettings* cros_settings = CrosSettings::Get();
949 bool allow_new_user = false; 949 bool allow_new_user = false;
950 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 950 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
951 if (allow_new_user) 951 if (allow_new_user)
952 return true; 952 return true;
953 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 953 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
954 } 954 }
955 955
956 } // namespace chromeos 956 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698