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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 public UserSessionManagerDelegate { | 177 public UserSessionManagerDelegate { |
178 public: | 178 public: |
179 LoginUtilsImpl() | 179 LoginUtilsImpl() |
180 : delegate_(NULL) { | 180 : delegate_(NULL) { |
181 } | 181 } |
182 | 182 |
183 virtual ~LoginUtilsImpl() { | 183 virtual ~LoginUtilsImpl() { |
184 } | 184 } |
185 | 185 |
186 // LoginUtils implementation: | 186 // LoginUtils implementation: |
187 virtual void RespectLocalePreference(Profile* profile, | |
188 const base::Closure& callback) override; | |
189 virtual void DoBrowserLaunch(Profile* profile, | 187 virtual void DoBrowserLaunch(Profile* profile, |
190 LoginDisplayHost* login_host) override; | 188 LoginDisplayHost* login_host) override; |
191 virtual void PrepareProfile( | 189 virtual void PrepareProfile( |
192 const UserContext& user_context, | 190 const UserContext& user_context, |
193 bool has_auth_cookies, | 191 bool has_auth_cookies, |
194 bool has_active_session, | 192 bool has_active_session, |
195 LoginUtils::Delegate* delegate) override; | 193 LoginUtils::Delegate* delegate) override; |
196 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; | 194 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; |
197 virtual void CompleteOffTheRecordLogin(const GURL& start_url) override; | 195 virtual void CompleteOffTheRecordLogin(const GURL& start_url) override; |
198 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 196 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
199 AuthStatusConsumer* consumer) override; | 197 AuthStatusConsumer* consumer) override; |
200 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, | 198 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, |
201 bool early_restart) override; | 199 bool early_restart) override; |
202 | 200 |
203 // UserSessionManager::Delegate implementation: | 201 // UserSessionManager::Delegate implementation: |
204 virtual void OnProfilePrepared(Profile* profile) override; | 202 virtual void OnProfilePrepared(Profile* profile) override; |
205 #if defined(ENABLE_RLZ) | 203 #if defined(ENABLE_RLZ) |
206 virtual void OnRlzInitialized() override; | 204 virtual void OnRlzInitialized() override; |
207 #endif | 205 #endif |
208 | 206 |
209 private: | 207 private: |
210 void DoBrowserLaunchInternal(Profile* profile, | 208 void DoBrowserLaunchInternal(Profile* profile, |
211 LoginDisplayHost* login_host, | 209 LoginDisplayHost* login_host, |
212 bool locale_pref_checked); | 210 bool locale_pref_checked); |
213 | 211 |
| 212 // Switch to the locale that |profile| wishes to use and invoke |callback|. |
| 213 virtual void RespectLocalePreference(Profile* profile, |
| 214 const base::Closure& callback); |
| 215 |
214 static void RunCallbackOnLocaleLoaded( | 216 static void RunCallbackOnLocaleLoaded( |
215 const base::Closure& callback, | 217 const base::Closure& callback, |
216 InputEventsBlocker* input_events_blocker, | 218 InputEventsBlocker* input_events_blocker, |
217 const std::string& locale, | 219 const std::string& locale, |
218 const std::string& loaded_locale, | 220 const std::string& loaded_locale, |
219 const bool success); | 221 const bool success); |
220 | 222 |
221 // Attempts restarting the browser process and esures that this does | 223 // Attempts restarting the browser process and esures that this does |
222 // not happen while we are still fetching new OAuth refresh tokens. | 224 // not happen while we are still fetching new OAuth refresh tokens. |
223 void AttemptRestart(Profile* profile); | 225 void AttemptRestart(Profile* profile); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 CrosSettings* cros_settings = CrosSettings::Get(); | 509 CrosSettings* cros_settings = CrosSettings::Get(); |
508 bool allow_new_user = false; | 510 bool allow_new_user = false; |
509 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 511 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
510 if (allow_new_user) | 512 if (allow_new_user) |
511 return true; | 513 return true; |
512 return cros_settings->FindEmailInList( | 514 return cros_settings->FindEmailInList( |
513 kAccountsPrefUsers, username, wildcard_match); | 515 kAccountsPrefUsers, username, wildcard_match); |
514 } | 516 } |
515 | 517 |
516 } // namespace chromeos | 518 } // namespace chromeos |
OLD | NEW |