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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 if (controller->auth_mode() != LoginPerformer::AUTH_MODE_INTERNAL) | 137 if (controller->auth_mode() != LoginPerformer::AUTH_MODE_INTERNAL) |
138 return false; | 138 return false; |
139 | 139 |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 } // namespace | 143 } // namespace |
144 | 144 |
145 struct DoBrowserLaunchOnLocaleLoadedData; | 145 struct DoBrowserLaunchOnLocaleLoadedData; |
146 | 146 |
147 class LoginUtilsImpl | 147 class LoginUtilsImpl : public LoginUtils, |
148 : public LoginUtils, | 148 public base::SupportsWeakPtr<LoginUtilsImpl>, |
149 public base::SupportsWeakPtr<LoginUtilsImpl>, | 149 public UserSessionManagerDelegate { |
150 public UserSessionManager::Delegate { | |
151 public: | 150 public: |
152 LoginUtilsImpl() | 151 LoginUtilsImpl() |
153 : delegate_(NULL) { | 152 : delegate_(NULL) { |
154 } | 153 } |
155 | 154 |
156 virtual ~LoginUtilsImpl() { | 155 virtual ~LoginUtilsImpl() { |
157 } | 156 } |
158 | 157 |
159 // LoginUtils implementation: | 158 // LoginUtils implementation: |
160 virtual void DoBrowserLaunch(Profile* profile, | 159 virtual void DoBrowserLaunch(Profile* profile, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 bool has_active_session, | 329 bool has_active_session, |
331 LoginUtils::Delegate* delegate) { | 330 LoginUtils::Delegate* delegate) { |
332 // TODO(nkostylev): We have to initialize LoginUtils delegate as long | 331 // TODO(nkostylev): We have to initialize LoginUtils delegate as long |
333 // as it coexist with SessionManager. | 332 // as it coexist with SessionManager. |
334 delegate_ = delegate; | 333 delegate_ = delegate; |
335 | 334 |
336 // For the transition part LoginUtils will just delegate profile | 335 // For the transition part LoginUtils will just delegate profile |
337 // creation and initialization to SessionManager. Later LoginUtils will be | 336 // creation and initialization to SessionManager. Later LoginUtils will be |
338 // removed and all LoginUtils clients will just work with SessionManager | 337 // removed and all LoginUtils clients will just work with SessionManager |
339 // directly. | 338 // directly. |
340 UserSessionManager::GetInstance()->StartSession(user_context, | 339 UserSessionManager::GetInstance()->StartSession( |
341 authenticator_, | 340 user_context, authenticator_, has_auth_cookies, has_active_session, this); |
342 has_auth_cookies, | |
343 has_active_session, | |
344 this); | |
345 } | 341 } |
346 | 342 |
347 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { | 343 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { |
348 if (delegate_ == delegate) | 344 if (delegate_ == delegate) |
349 delegate_ = NULL; | 345 delegate_ = NULL; |
350 } | 346 } |
351 | 347 |
352 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile, | 348 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile, |
353 bool early_restart) { | 349 bool early_restart) { |
354 if (ProfileHelper::IsSigninProfile(profile)) | 350 if (ProfileHelper::IsSigninProfile(profile)) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 CrosSettings* cros_settings = CrosSettings::Get(); | 458 CrosSettings* cros_settings = CrosSettings::Get(); |
463 bool allow_new_user = false; | 459 bool allow_new_user = false; |
464 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 460 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
465 if (allow_new_user) | 461 if (allow_new_user) |
466 return true; | 462 return true; |
467 return cros_settings->FindEmailInList( | 463 return cros_settings->FindEmailInList( |
468 kAccountsPrefUsers, username, wildcard_match); | 464 kAccountsPrefUsers, username, wildcard_match); |
469 } | 465 } |
470 | 466 |
471 } // namespace chromeos | 467 } // namespace chromeos |
OLD | NEW |