Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 #include "net/url_request/url_request_context.h" | 70 #include "net/url_request/url_request_context.h" |
| 71 #include "net/url_request/url_request_context_getter.h" | 71 #include "net/url_request/url_request_context_getter.h" |
| 72 #include "ui/gfx/gl/gl_switches.h" | 72 #include "ui/gfx/gl/gl_switches.h" |
| 73 | 73 |
| 74 using content::BrowserThread; | 74 using content::BrowserThread; |
| 75 | 75 |
| 76 namespace chromeos { | 76 namespace chromeos { |
| 77 | 77 |
| 78 namespace { | 78 namespace { |
| 79 | 79 |
| 80 // OAuth token verification retry count. | |
| 81 const int kMaxOAuthTokenVerificationAttemptCount = 5; | |
| 82 // OAuth token verification retry delay. | |
| 83 const int kOAuthVerificationRestartDelay = 10000; // ms | |
| 84 | |
| 80 // Affixes for Auth token received from ClientLogin request. | 85 // Affixes for Auth token received from ClientLogin request. |
| 81 const char kAuthPrefix[] = "Auth="; | 86 const char kAuthPrefix[] = "Auth="; |
| 82 const char kAuthSuffix[] = "\n"; | 87 const char kAuthSuffix[] = "\n"; |
| 83 | 88 |
| 84 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs. | 89 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs. |
| 85 const char kGuestModeLoggingLevel[] = "1"; | 90 const char kGuestModeLoggingLevel[] = "1"; |
| 86 | 91 |
| 87 // Format of command line switch. | 92 // Format of command line switch. |
| 88 const char kSwitchFormatString[] = " --%s=\"%s\""; | 93 const char kSwitchFormatString[] = " --%s=\"%s\""; |
| 89 | 94 |
| 90 // User name which is used in the Guest session. | 95 // User name which is used in the Guest session. |
| 91 const char kGuestUserName[] = ""; | 96 const char kGuestUserName[] = ""; |
| 92 | 97 |
| 93 // The service scope of the OAuth v2 token that ChromeOS login will be | 98 // The service scope of the OAuth v2 token that ChromeOS login will be |
| 94 // requesting. | 99 // requesting. |
| 95 // TODO(zelidrag): Figure out if we need to add more services here. | 100 // TODO(zelidrag): Figure out if we need to add more services here. |
| 96 const char kServiceScopeChromeOS[] = | 101 const char kServiceScopeChromeOS[] = |
| 97 "https://www.googleapis.com/auth/chromesync"; | 102 "https://www.googleapis.com/auth/chromesync"; |
| 98 | 103 |
| 99 const char kServiceScopeChromeOSDeviceManagement[] = | 104 const char kServiceScopeChromeOSDeviceManagement[] = |
| 100 "https://www.googleapis.com/auth/chromeosdevicemanagement"; | 105 "https://www.googleapis.com/auth/chromeosdevicemanagement"; |
| 101 } // namespace | 106 } // namespace |
| 102 | 107 |
| 103 // Task for fetching tokens from UI thread. | |
| 104 class StartSyncOnUIThreadTask : public Task { | |
| 105 public: | |
| 106 explicit StartSyncOnUIThreadTask( | |
| 107 const GaiaAuthConsumer::ClientLoginResult& credentials) | |
| 108 : credentials_(credentials) {} | |
| 109 virtual ~StartSyncOnUIThreadTask() {} | |
| 110 | |
| 111 // Task override. | |
| 112 virtual void Run() OVERRIDE { | |
| 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 114 LoginUtils::Get()->FetchCookies(ProfileManager::GetDefaultProfile(), | |
| 115 credentials_); | |
| 116 LoginUtils::Get()->StartSync(ProfileManager::GetDefaultProfile(), | |
| 117 credentials_); | |
| 118 } | |
| 119 | |
| 120 private: | |
| 121 GaiaAuthConsumer::ClientLoginResult credentials_; | |
| 122 | |
| 123 DISALLOW_COPY_AND_ASSIGN(StartSyncOnUIThreadTask); | |
| 124 }; | |
| 125 | |
| 126 // Transfers initial set of Profile cookies from the default profile. | 108 // Transfers initial set of Profile cookies from the default profile. |
| 127 class TransferDefaultCookiesOnIOThreadTask : public Task { | 109 class TransferDefaultCookiesOnIOThreadTask : public Task { |
| 128 public: | 110 public: |
| 129 TransferDefaultCookiesOnIOThreadTask( | 111 TransferDefaultCookiesOnIOThreadTask( |
| 130 net::URLRequestContextGetter* auth_context, | 112 net::URLRequestContextGetter* auth_context, |
| 131 net::URLRequestContextGetter* new_context) | 113 net::URLRequestContextGetter* new_context) |
| 132 : auth_context_(auth_context), | 114 : auth_context_(auth_context), |
| 133 new_context_(new_context) {} | 115 new_context_(new_context) {} |
| 134 virtual ~TransferDefaultCookiesOnIOThreadTask() {} | 116 virtual ~TransferDefaultCookiesOnIOThreadTask() {} |
| 135 | 117 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 http_transaction_factory()->GetSession()->http_auth_cache()); | 165 http_transaction_factory()->GetSession()->http_auth_cache()); |
| 184 } | 166 } |
| 185 | 167 |
| 186 private: | 168 private: |
| 187 net::URLRequestContextGetter* auth_context_; | 169 net::URLRequestContextGetter* auth_context_; |
| 188 net::URLRequestContextGetter* new_context_; | 170 net::URLRequestContextGetter* new_context_; |
| 189 | 171 |
| 190 DISALLOW_COPY_AND_ASSIGN(TransferDefaultAuthCacheOnIOThreadTask); | 172 DISALLOW_COPY_AND_ASSIGN(TransferDefaultAuthCacheOnIOThreadTask); |
| 191 }; | 173 }; |
| 192 | 174 |
| 193 // Verifies OAuth1 access token by performing OAuthLogin. | 175 // Verifies OAuth1 access token by performing OAuthLogin. Fetches user cookies |
| 194 class OAuthLoginVerifier : public GaiaOAuthConsumer { | 176 // on successful OAuth authentication. |
| 177 class OAuthLoginVerifier : public base::SupportsWeakPtr<OAuthLoginVerifier>, | |
| 178 public GaiaOAuthConsumer, | |
| 179 public GaiaAuthConsumer { | |
| 195 public: | 180 public: |
| 196 OAuthLoginVerifier(Profile* user_profile, | 181 class Delegate { |
| 182 public: | |
| 183 virtual ~Delegate() {} | |
| 184 virtual void OnOAuthVerificationSucceeded(const std::string& user_name, | |
| 185 const std::string& sid, | |
| 186 const std::string& lsid, | |
| 187 const std::string& auth) {} | |
| 188 virtual void OnOAuthVerificationFailed(const std::string& user_name) {} | |
| 189 virtual void OnUserCookiesFetchSucceeded(const std::string& user_name) {} | |
| 190 virtual void OnUserCookiesFetchFailed(const std::string& user_name) {} | |
| 191 }; | |
| 192 | |
| 193 OAuthLoginVerifier(OAuthLoginVerifier::Delegate* delegate, | |
| 194 Profile* user_profile, | |
| 197 const std::string& oauth1_token, | 195 const std::string& oauth1_token, |
| 198 const std::string& oauth1_secret, | 196 const std::string& oauth1_secret, |
| 199 const std::string& username) | 197 const std::string& username) |
| 200 : oauth_fetcher_(this, | 198 : delegate_(delegate), |
| 199 oauth_fetcher_(this, | |
| 201 user_profile->GetOffTheRecordProfile()->GetRequestContext(), | 200 user_profile->GetOffTheRecordProfile()->GetRequestContext(), |
| 202 user_profile->GetOffTheRecordProfile(), | 201 user_profile->GetOffTheRecordProfile(), |
| 203 kServiceScopeChromeOS), | 202 kServiceScopeChromeOS), |
| 203 gaia_fetcher_(this, | |
| 204 std::string(GaiaConstants::kChromeOSSource), | |
| 205 user_profile->GetRequestContext()), | |
| 204 oauth1_token_(oauth1_token), | 206 oauth1_token_(oauth1_token), |
| 205 oauth1_secret_(oauth1_secret), | 207 oauth1_secret_(oauth1_secret), |
| 206 username_(username) { | 208 username_(username), |
| 209 user_profile_(user_profile), | |
| 210 verification_count_(0), | |
| 211 step_(VERIFICATION_STEP_UNVERIFIED) { | |
| 207 } | 212 } |
| 208 virtual ~OAuthLoginVerifier() {} | 213 virtual ~OAuthLoginVerifier() {} |
| 209 | 214 |
| 210 void Start() { | 215 bool is_done() { |
| 216 return step_ == VERIFICATION_STEP_FAILED || | |
| 217 step_ == VERIFICATION_STEP_COOKIES_FETCHED; | |
| 218 } | |
| 219 | |
| 220 void StartOAuthVerification() { | |
| 211 if (oauth1_token_.empty() || oauth1_secret_.empty()) { | 221 if (oauth1_token_.empty() || oauth1_secret_.empty()) { |
| 212 // Empty OAuth1 access token or secret probably means that we are | 222 // Empty OAuth1 access token or secret probably means that we are |
| 213 // dealing with a legacy ChromeOS account. This should be treated as | 223 // dealing with a legacy ChromeOS account. This should be treated as |
| 214 // invalid/expired token. | 224 // invalid/expired token. |
| 215 OnOAuthLoginFailure(GoogleServiceAuthError( | 225 OnOAuthLoginFailure(GoogleServiceAuthError( |
| 216 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); | 226 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); |
| 217 } else { | 227 } else { |
| 218 oauth_fetcher_.StartOAuthLogin(GaiaConstants::kChromeOSSource, | 228 oauth_fetcher_.StartOAuthLogin(GaiaConstants::kChromeOSSource, |
| 219 GaiaConstants::kPicasaService, | 229 GaiaConstants::kPicasaService, |
| 220 oauth1_token_, | 230 oauth1_token_, |
| 221 oauth1_secret_); | 231 oauth1_secret_); |
| 222 } | 232 } |
| 223 } | 233 } |
| 224 | 234 |
| 235 void ContinueVerification() { | |
| 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 237 // Check if we have finished with this one already. | |
| 238 if (is_done()) | |
| 239 return; | |
| 240 | |
| 241 if (user_profile_ != ProfileManager::GetDefaultProfile()) | |
| 242 return; | |
| 243 | |
| 244 // Check if we currently trying to fetch something. | |
| 245 if (oauth_fetcher_.HasPendingFetch() || gaia_fetcher_.HasPendingFetch()) | |
| 246 return; | |
| 247 | |
| 248 if (CrosLibrary::Get()->EnsureLoaded()) { | |
| 249 // Delay the verification if the network is not connected or on a captive | |
| 250 // portal. | |
| 251 const Network* network = | |
| 252 CrosLibrary::Get()->GetNetworkLibrary()->active_network(); | |
| 253 if (!network || !network->connected() || network->restricted_pool()) { | |
| 254 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | |
| 255 base::Bind(&OAuthLoginVerifier::ContinueVerification, AsWeakPtr()), | |
| 256 kOAuthVerificationRestartDelay); | |
|
Nikita (slow)
2011/11/22 09:14:39
verification_count_ is increased below this block.
Nikita (slow)
2011/11/22 09:21:56
Reading it differently, I think that initial idea
| |
| 257 return; | |
| 258 } | |
| 259 } | |
| 260 | |
| 261 verification_count_++; | |
| 262 if (step_ == VERIFICATION_STEP_UNVERIFIED) { | |
| 263 DVLOG(1) << "Retrying to verify OAuth1 access tokens."; | |
| 264 StartOAuthVerification(); | |
| 265 } else { | |
| 266 DVLOG(1) << "Retrying to fetch user cookies."; | |
| 267 StartCookiesRetreival(); | |
| 268 } | |
| 269 } | |
| 270 | |
| 271 private: | |
| 272 typedef enum { | |
| 273 VERIFICATION_STEP_UNVERIFIED, | |
| 274 VERIFICATION_STEP_OAUTH_VERIFIED, | |
| 275 VERIFICATION_STEP_COOKIES_FETCHED, | |
| 276 VERIFICATION_STEP_FAILED, | |
| 277 } VerificationStep; | |
| 278 | |
| 279 // Kicks off GAIA session cookie retreival process. | |
| 280 void StartCookiesRetreival() { | |
| 281 DCHECK(!sid_.empty()); | |
| 282 DCHECK(!lsid_.empty()); | |
| 283 gaia_fetcher_.StartIssueAuthToken(sid_, lsid_, GaiaConstants::kGaiaService); | |
| 284 } | |
| 285 | |
| 286 // Decides how to proceed on GAIA response and other errors. It can schedule | |
| 287 // to rerun the verification process if detects transient network or service | |
| 288 // errors. | |
| 289 bool RetryOnError(const GoogleServiceAuthError& error) { | |
| 290 // If we can't connect to GAIA due to network or service related reasons, | |
| 291 // we should attempt OAuth token verification again. | |
| 292 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED || | |
| 293 error.state() == GoogleServiceAuthError::SERVICE_UNAVAILABLE) { | |
| 294 if (verification_count_ < kMaxOAuthTokenVerificationAttemptCount) { | |
| 295 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | |
| 296 base::Bind(&OAuthLoginVerifier::ContinueVerification, AsWeakPtr()), | |
| 297 kOAuthVerificationRestartDelay); | |
| 298 return true; | |
| 299 } | |
| 300 } | |
| 301 step_ = VERIFICATION_STEP_FAILED; | |
| 302 return false; | |
| 303 } | |
| 304 | |
| 225 // GaiaOAuthConsumer implementation: | 305 // GaiaOAuthConsumer implementation: |
| 226 virtual void OnOAuthLoginSuccess(const std::string& sid, | 306 virtual void OnOAuthLoginSuccess(const std::string& sid, |
| 227 const std::string& lsid, | 307 const std::string& lsid, |
| 228 const std::string& auth) OVERRIDE { | 308 const std::string& auth) OVERRIDE { |
| 229 GaiaAuthConsumer::ClientLoginResult credentials( | 309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 230 sid, lsid, auth, std::string()); | 310 step_ = VERIFICATION_STEP_OAUTH_VERIFIED; |
| 231 UserManager::Get()->set_offline_login(false); | 311 verification_count_ = 0; |
| 232 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 312 sid_ = sid; |
| 233 new StartSyncOnUIThreadTask(credentials)); | 313 lsid_ = lsid; |
| 314 delegate_->OnOAuthVerificationSucceeded(username_, sid, lsid, auth); | |
| 315 StartCookiesRetreival(); | |
| 234 } | 316 } |
| 235 | 317 |
| 236 virtual void OnOAuthLoginFailure( | 318 virtual void OnOAuthLoginFailure( |
| 237 const GoogleServiceAuthError& error) OVERRIDE { | 319 const GoogleServiceAuthError& error) OVERRIDE { |
| 238 LOG(WARNING) << "Failed to verify OAuth1 access tokens, error: " | 320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 239 << error.state(); | 321 LOG(WARNING) << "Failed to verify OAuth1 access tokens," |
| 240 | 322 << " error.state=" << error.state(); |
| 241 // Mark this account's OAuth token state as invalid if the failure is not | 323 if (!RetryOnError(error)) |
| 242 // caused by network error. | 324 delegate_->OnOAuthVerificationFailed(username_); |
| 243 if (error.state() != GoogleServiceAuthError::CONNECTION_FAILED) { | |
| 244 UserManager::Get()->SaveUserOAuthStatus(username_, | |
| 245 User::OAUTH_TOKEN_STATUS_INVALID); | |
| 246 } else { | |
| 247 UserManager::Get()->set_offline_login(true); | |
| 248 } | |
| 249 } | 325 } |
| 250 | 326 |
| 251 private: | 327 void OnCookueFetchFailed(const GoogleServiceAuthError& error) { |
|
Nikita (slow)
2011/11/22 09:14:39
nit: fix spelling OnCookieFetchFailed
| |
| 252 GaiaOAuthFetcher oauth_fetcher_; | 328 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 253 std::string oauth1_token_; | 329 if (!RetryOnError(error)) |
| 254 std::string oauth1_secret_; | 330 delegate_->OnUserCookiesFetchFailed(username_); |
| 255 std::string username_; | |
| 256 | |
| 257 DISALLOW_COPY_AND_ASSIGN(OAuthLoginVerifier); | |
| 258 }; | |
| 259 | |
| 260 // Verifies OAuth1 access token by performing OAuthLogin. | |
| 261 class UserSessionCookieFetcher : public GaiaAuthConsumer { | |
| 262 public: | |
| 263 explicit UserSessionCookieFetcher(Profile* user_profile) | |
| 264 : gaia_fetcher_(this, | |
| 265 std::string(GaiaConstants::kChromeOSSource), | |
| 266 user_profile->GetRequestContext()) { | |
| 267 } | |
| 268 virtual ~UserSessionCookieFetcher() {} | |
| 269 | |
| 270 void Start(const GaiaAuthConsumer::ClientLoginResult& credentials) { | |
| 271 gaia_fetcher_.StartIssueAuthToken(credentials.sid, credentials.lsid, | |
| 272 GaiaConstants::kGaiaService); | |
| 273 } | 331 } |
| 274 | 332 |
| 275 // GaiaAuthConsumer overrides. | 333 // GaiaAuthConsumer overrides. |
| 276 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 334 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 277 const std::string& auth_token) OVERRIDE { | 335 const std::string& auth_token) OVERRIDE { |
| 278 gaia_fetcher_.StartMergeSession(auth_token); | 336 gaia_fetcher_.StartMergeSession(auth_token); |
| 279 } | 337 } |
| 280 | 338 |
| 281 virtual void OnIssueAuthTokenFailure(const std::string& service, | 339 virtual void OnIssueAuthTokenFailure(const std::string& service, |
| 282 const GoogleServiceAuthError& error) OVERRIDE { | 340 const GoogleServiceAuthError& error) OVERRIDE { |
| 283 LOG(WARNING) << "Failed IssueAuthToken request, error: " << error.state(); | 341 DVLOG(1) << "Failed IssueAuthToken request," |
| 284 HandlerGaiaAuthError(error); | 342 << " error.state=" << error.state(); |
| 285 delete this; | 343 OnCookueFetchFailed(error); |
| 286 } | 344 } |
| 287 | 345 |
| 288 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE { | 346 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE { |
| 289 VLOG(1) << "MergeSession successful."; | 347 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 290 delete this; | 348 DVLOG(1) << "MergeSession successful."; |
| 349 step_ = VERIFICATION_STEP_COOKIES_FETCHED; | |
| 350 delegate_->OnUserCookiesFetchSucceeded(username_); | |
| 291 } | 351 } |
| 292 | 352 |
| 293 virtual void OnMergeSessionFailure( | 353 virtual void OnMergeSessionFailure( |
| 294 const GoogleServiceAuthError& error) OVERRIDE { | 354 const GoogleServiceAuthError& error) OVERRIDE { |
| 295 LOG(WARNING) << "Failed MergeSession request, error: " << error.state(); | 355 DVLOG(1) << "Failed MergeSession request," |
| 296 HandlerGaiaAuthError(error); | 356 << " error.state=" << error.state(); |
| 297 delete this; | 357 OnCookueFetchFailed(error); |
| 298 } | 358 } |
| 299 | 359 |
| 300 private: | 360 OAuthLoginVerifier::Delegate* delegate_; |
| 301 void HandlerGaiaAuthError(const GoogleServiceAuthError& error) { | 361 GaiaOAuthFetcher oauth_fetcher_; |
| 302 // Mark this account's login state as offline if we encountered a network | 362 GaiaAuthFetcher gaia_fetcher_; |
| 303 // error. That will make us verify user OAuth token and try to fetch session | 363 std::string oauth1_token_; |
| 304 // cookies again once we detect that the machine comes online. | 364 std::string oauth1_secret_; |
| 305 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED) | 365 std::string sid_; |
| 306 UserManager::Get()->set_offline_login(true); | 366 std::string lsid_; |
| 307 } | 367 std::string username_; |
| 368 Profile* user_profile_; | |
| 369 int verification_count_; | |
| 370 VerificationStep step_; | |
| 308 | 371 |
| 309 GaiaAuthFetcher gaia_fetcher_; | 372 DISALLOW_COPY_AND_ASSIGN(OAuthLoginVerifier); |
| 310 DISALLOW_COPY_AND_ASSIGN(UserSessionCookieFetcher); | |
| 311 }; | 373 }; |
| 312 | 374 |
| 313 // Fetches the oauth token for the device management service. Since Profile | 375 // Fetches the oauth token for the device management service. Since Profile |
| 314 // creation might be blocking on a user policy fetch, this fetcher must always | 376 // creation might be blocking on a user policy fetch, this fetcher must always |
| 315 // send a (possibly empty) token to the BrowserPolicyConnector, which will then | 377 // send a (possibly empty) token to the BrowserPolicyConnector, which will then |
| 316 // let the policy subsystem proceed and resume Profile creation. | 378 // let the policy subsystem proceed and resume Profile creation. |
| 317 // Sending the token even when no Profile is pending is also OK. | 379 // Sending the token even when no Profile is pending is also OK. |
| 318 class PolicyOAuthFetcher : public GaiaOAuthConsumer { | 380 class PolicyOAuthFetcher : public GaiaOAuthConsumer { |
| 319 public: | 381 public: |
| 320 // Fetches the device management service's oauth token using |oauth1_token| | 382 // Fetches the device management service's oauth token using |oauth1_token| |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 | 521 |
| 460 int pid_; | 522 int pid_; |
| 461 std::string command_line_; | 523 std::string command_line_; |
| 462 PrefService* local_state_; | 524 PrefService* local_state_; |
| 463 base::OneShotTimer<JobRestartRequest> timer_; | 525 base::OneShotTimer<JobRestartRequest> timer_; |
| 464 }; | 526 }; |
| 465 | 527 |
| 466 class LoginUtilsImpl : public LoginUtils, | 528 class LoginUtilsImpl : public LoginUtils, |
| 467 public ProfileManagerObserver, | 529 public ProfileManagerObserver, |
| 468 public GaiaOAuthConsumer, | 530 public GaiaOAuthConsumer, |
| 531 public OAuthLoginVerifier::Delegate, | |
| 469 public net::NetworkChangeNotifier::OnlineStateObserver { | 532 public net::NetworkChangeNotifier::OnlineStateObserver { |
| 470 public: | 533 public: |
| 471 LoginUtilsImpl() | 534 LoginUtilsImpl() |
| 472 : background_view_(NULL), | 535 : background_view_(NULL), |
| 473 pending_requests_(false), | 536 pending_requests_(false), |
| 474 using_oauth_(false), | 537 using_oauth_(false), |
| 475 has_cookies_(false), | 538 has_cookies_(false), |
| 476 delegate_(NULL), | 539 delegate_(NULL), |
| 477 job_restart_request_(NULL) { | 540 job_restart_request_(NULL) { |
| 478 net::NetworkChangeNotifier::AddOnlineStateObserver(this); | 541 net::NetworkChangeNotifier::AddOnlineStateObserver(this); |
| 479 } | 542 } |
| 480 | 543 |
| 481 virtual ~LoginUtilsImpl() { | 544 virtual ~LoginUtilsImpl() { |
| 482 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); | 545 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); |
| 483 } | 546 } |
| 484 | 547 |
| 485 // LoginUtils implementation: | 548 // LoginUtils implementation: |
| 486 virtual void PrepareProfile( | 549 virtual void PrepareProfile( |
| 487 const std::string& username, | 550 const std::string& username, |
| 488 const std::string& password, | 551 const std::string& password, |
| 489 const GaiaAuthConsumer::ClientLoginResult& credentials, | 552 const GaiaAuthConsumer::ClientLoginResult& credentials, |
| 490 bool pending_requests, | 553 bool pending_requests, |
| 491 bool using_oauth, | 554 bool using_oauth, |
| 492 bool has_cookies, | 555 bool has_cookies, |
| 493 LoginUtils::Delegate* delegate) OVERRIDE; | 556 LoginUtils::Delegate* delegate) OVERRIDE; |
| 494 virtual void DelegateDeleted(Delegate* delegate) OVERRIDE; | 557 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; |
| 495 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; | 558 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; |
| 496 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; | 559 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; |
| 497 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 560 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
| 498 LoginStatusConsumer* consumer) OVERRIDE; | 561 LoginStatusConsumer* consumer) OVERRIDE; |
| 499 virtual void PrewarmAuthentication() OVERRIDE; | 562 virtual void PrewarmAuthentication() OVERRIDE; |
| 500 virtual void RestoreAuthenticationSession(const std::string& user_name, | 563 virtual void RestoreAuthenticationSession(const std::string& user_name, |
| 501 Profile* profile) OVERRIDE; | 564 Profile* profile) OVERRIDE; |
| 502 virtual void FetchCookies( | |
| 503 Profile* profile, | |
| 504 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE; | |
| 505 virtual void StartTokenServices(Profile* user_profile) OVERRIDE; | 565 virtual void StartTokenServices(Profile* user_profile) OVERRIDE; |
| 506 virtual void StartSync( | 566 virtual void StartSync( |
| 507 Profile* profile, | 567 Profile* profile, |
| 508 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE; | 568 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE; |
| 509 virtual void SetBackgroundView( | 569 virtual void SetBackgroundView( |
| 510 chromeos::BackgroundView* background_view) OVERRIDE; | 570 chromeos::BackgroundView* background_view) OVERRIDE; |
| 511 virtual chromeos::BackgroundView* GetBackgroundView() OVERRIDE; | 571 virtual chromeos::BackgroundView* GetBackgroundView() OVERRIDE; |
| 512 virtual void TransferDefaultCookies(Profile* default_profile, | 572 virtual void TransferDefaultCookies(Profile* default_profile, |
| 513 Profile* new_profile) OVERRIDE; | 573 Profile* new_profile) OVERRIDE; |
| 514 virtual void TransferDefaultAuthCache(Profile* default_profile, | 574 virtual void TransferDefaultAuthCache(Profile* default_profile, |
| 515 Profile* new_profile) OVERRIDE; | 575 Profile* new_profile) OVERRIDE; |
| 516 | 576 |
| 517 // ProfileManagerObserver implementation: | 577 // ProfileManagerObserver implementation: |
| 518 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE; | 578 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE; |
| 519 | 579 |
| 520 // GaiaOAuthConsumer overrides. | 580 // GaiaOAuthConsumer overrides. |
| 521 virtual void OnGetOAuthTokenSuccess(const std::string& oauth_token) OVERRIDE; | 581 virtual void OnGetOAuthTokenSuccess(const std::string& oauth_token) OVERRIDE; |
| 522 virtual void OnGetOAuthTokenFailure( | 582 virtual void OnGetOAuthTokenFailure( |
| 523 const GoogleServiceAuthError& error) OVERRIDE; | 583 const GoogleServiceAuthError& error) OVERRIDE; |
| 524 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, | 584 virtual void OnOAuthGetAccessTokenSuccess(const std::string& token, |
| 525 const std::string& secret) OVERRIDE; | 585 const std::string& secret) OVERRIDE; |
| 526 virtual void OnOAuthGetAccessTokenFailure( | 586 virtual void OnOAuthGetAccessTokenFailure( |
| 527 const GoogleServiceAuthError& error) OVERRIDE; | 587 const GoogleServiceAuthError& error) OVERRIDE; |
| 528 | 588 |
| 589 // OAuthLoginVerifier::Delegate overrides. | |
| 590 virtual void OnOAuthVerificationSucceeded(const std::string& user_name, | |
| 591 const std::string& sid, | |
| 592 const std::string& lsid, | |
| 593 const std::string& auth) OVERRIDE; | |
| 594 virtual void OnOAuthVerificationFailed(const std::string& user_name) OVERRIDE; | |
| 595 | |
| 529 // net::NetworkChangeNotifier::OnlineStateObserver overrides. | 596 // net::NetworkChangeNotifier::OnlineStateObserver overrides. |
| 530 virtual void OnOnlineStateChanged(bool online) OVERRIDE; | 597 virtual void OnOnlineStateChanged(bool online) OVERRIDE; |
| 531 | 598 |
| 532 // Given the authenticated credentials from the cookie jar, try to exchange | 599 // Given the authenticated credentials from the cookie jar, try to exchange |
| 533 // fetch OAuth request, v1 and v2 tokens. | 600 // fetch OAuth request, v1 and v2 tokens. |
| 534 void FetchOAuth1AccessToken(Profile* auth_profile); | 601 void FetchOAuth1AccessToken(Profile* auth_profile); |
| 535 | 602 |
| 536 protected: | 603 protected: |
| 537 virtual std::string GetOffTheRecordCommandLine( | 604 virtual std::string GetOffTheRecordCommandLine( |
| 538 const GURL& start_url, | 605 const GURL& start_url, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 policy_oauth_fetcher_.reset( | 757 policy_oauth_fetcher_.reset( |
| 691 new PolicyOAuthFetcher(authenticator_->authentication_profile())); | 758 new PolicyOAuthFetcher(authenticator_->authentication_profile())); |
| 692 policy_oauth_fetcher_->Start(); | 759 policy_oauth_fetcher_->Start(); |
| 693 } | 760 } |
| 694 | 761 |
| 695 // The default profile will have been changed because the ProfileManager | 762 // The default profile will have been changed because the ProfileManager |
| 696 // will process the notification that the UserManager sends out. | 763 // will process the notification that the UserManager sends out. |
| 697 ProfileManager::CreateDefaultProfileAsync(this); | 764 ProfileManager::CreateDefaultProfileAsync(this); |
| 698 } | 765 } |
| 699 | 766 |
| 700 void LoginUtilsImpl::DelegateDeleted(Delegate* delegate) { | 767 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { |
| 701 if (delegate_ == delegate) | 768 if (delegate_ == delegate) |
| 702 delegate_ = NULL; | 769 delegate_ = NULL; |
| 703 } | 770 } |
| 704 | 771 |
| 705 void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) { | 772 void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) { |
| 706 CHECK(user_profile); | 773 CHECK(user_profile); |
| 707 switch (status) { | 774 switch (status) { |
| 708 case STATUS_INITIALIZED: | 775 case STATUS_INITIALIZED: |
| 709 break; | 776 break; |
| 710 case STATUS_CREATED: | 777 case STATUS_CREATED: |
| 711 if (UserManager::Get()->current_user_is_new()) | 778 if (UserManager::Get()->current_user_is_new()) |
| 712 SetFirstLoginPrefs(user_profile->GetPrefs()); | 779 SetFirstLoginPrefs(user_profile->GetPrefs()); |
| 713 RespectLocalePreference(user_profile); | 780 RespectLocalePreference(user_profile); |
| 714 return; | 781 return; |
| 715 case STATUS_FAIL: | 782 case STATUS_FAIL: |
| 716 default: | 783 default: |
| 717 NOTREACHED(); | 784 NOTREACHED(); |
| 718 return; | 785 return; |
| 719 } | 786 } |
| 720 | 787 |
| 721 // Initialize the user-policy backend. | |
| 722 if (!using_oauth_) { | |
| 723 g_browser_process->browser_policy_connector()-> | |
| 724 SetUserPolicyTokenService(user_profile->GetTokenService()); | |
| 725 } | |
| 726 | |
| 727 // We suck. This is a hack since we do not have the enterprise feature | |
| 728 // done yet to pull down policies from the domain admin. We'll take this | |
| 729 // out when we get that done properly. | |
| 730 // TODO(xiyuan): Remove this once enterprise feature is ready. | |
| 731 if (EndsWith(username_, "@google.com", true)) { | |
| 732 PrefService* pref_service = user_profile->GetPrefs(); | |
| 733 pref_service->SetBoolean(prefs::kEnableScreenLock, true); | |
| 734 } | |
| 735 | |
| 736 BootTimesLoader* btl = BootTimesLoader::Get(); | 788 BootTimesLoader* btl = BootTimesLoader::Get(); |
| 737 btl->AddLoginTimeMarker("UserProfileGotten", false); | 789 btl->AddLoginTimeMarker("UserProfileGotten", false); |
| 738 | 790 |
| 739 if (using_oauth_) { | 791 if (using_oauth_) { |
| 740 // Reuse the access token fetched by the PolicyOAuthFetcher, if it was | 792 // Reuse the access token fetched by the PolicyOAuthFetcher, if it was |
| 741 // used to fetch policies before Profile creation. | 793 // used to fetch policies before Profile creation. |
| 742 if (policy_oauth_fetcher_.get() && | 794 if (policy_oauth_fetcher_.get() && |
| 743 !policy_oauth_fetcher_->oauth1_token().empty()) { | 795 !policy_oauth_fetcher_->oauth1_token().empty()) { |
| 744 VLOG(1) << "Resuming profile creation after fetching policy token"; | 796 VLOG(1) << "Resuming profile creation after fetching policy token"; |
| 745 StoreOAuth1AccessToken(user_profile, | 797 StoreOAuth1AccessToken(user_profile, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 771 VerifyOAuth1AccessToken(user_profile, oauth1_token, oauth1_secret); | 823 VerifyOAuth1AccessToken(user_profile, oauth1_token, oauth1_secret); |
| 772 } else { | 824 } else { |
| 773 // If we don't have it, fetch OAuth1 access token. | 825 // If we don't have it, fetch OAuth1 access token. |
| 774 // Use off-the-record profile that was used for this step. It should | 826 // Use off-the-record profile that was used for this step. It should |
| 775 // already contain all needed cookies that will let us skip GAIA's user | 827 // already contain all needed cookies that will let us skip GAIA's user |
| 776 // authentication UI. | 828 // authentication UI. |
| 777 // | 829 // |
| 778 // TODO(rickcam) We should use an isolated App here. | 830 // TODO(rickcam) We should use an isolated App here. |
| 779 FetchOAuth1AccessToken(authenticator_->authentication_profile()); | 831 FetchOAuth1AccessToken(authenticator_->authentication_profile()); |
| 780 } | 832 } |
| 781 } else { | |
| 782 // Since we're doing parallel authentication, only new user sign in | |
| 783 // would perform online auth before calling PrepareProfile. | |
| 784 // For existing users there's usually a pending online auth request. | |
| 785 // Cookies will be fetched after it's is succeeded. | |
| 786 if (!pending_requests_) { | |
| 787 FetchCookies(user_profile, credentials_); | |
| 788 } | |
| 789 } | |
| 790 | |
| 791 if (!using_oauth_) { | |
| 792 // We don't need authenticator instance anymore in LoginUtils. | |
| 793 // Release it so that ScreenLocker would create a separate instance. | |
| 794 // Note that for GAIA WebUI login authenticator instance is reset in | |
| 795 // OnOAuthGetAccessTokenSuccess(...). | |
| 796 authenticator_ = NULL; | |
| 797 } | |
| 798 | |
| 799 // Supply credentials for sync and others to use. Load tokens from disk. | |
| 800 if (!using_oauth_) { | |
| 801 // For existing users there's usually a pending online auth request. | |
| 802 // Tokens will be fetched after it's is succeeded. | |
| 803 if (!pending_requests_) | |
| 804 StartSync(user_profile, credentials_); | |
| 805 } | 833 } |
| 806 | 834 |
| 807 // Own TPM device if, for any reason, it has not been done in EULA | 835 // Own TPM device if, for any reason, it has not been done in EULA |
| 808 // wizard screen. | 836 // wizard screen. |
| 809 if (system::runtime_environment::IsRunningOnChromeOS()) { | 837 if (system::runtime_environment::IsRunningOnChromeOS()) { |
| 810 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); | 838 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); |
| 811 btl->AddLoginTimeMarker("TPMOwn-Start", false); | 839 btl->AddLoginTimeMarker("TPMOwn-Start", false); |
| 812 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { | 840 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { |
| 813 if (cryptohome->TpmIsOwned()) { | 841 if (cryptohome->TpmIsOwned()) { |
| 814 cryptohome->TpmClearStoredPassword(); | 842 cryptohome->TpmClearStoredPassword(); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 839 auth_profile->GetRequestContext(), | 867 auth_profile->GetRequestContext(), |
| 840 auth_profile, | 868 auth_profile, |
| 841 kServiceScopeChromeOS)); | 869 kServiceScopeChromeOS)); |
| 842 // Let's first get the Oauth request token and OAuth1 token+secret. | 870 // Let's first get the Oauth request token and OAuth1 token+secret. |
| 843 // Once we get that, we will kick off individual requests for OAuth2 tokens | 871 // Once we get that, we will kick off individual requests for OAuth2 tokens |
| 844 // for all our services. | 872 // for all our services. |
| 845 oauth_fetcher_->SetAutoFetchLimit(GaiaOAuthFetcher::OAUTH1_ALL_ACCESS_TOKEN); | 873 oauth_fetcher_->SetAutoFetchLimit(GaiaOAuthFetcher::OAUTH1_ALL_ACCESS_TOKEN); |
| 846 oauth_fetcher_->StartGetOAuthTokenRequest(); | 874 oauth_fetcher_->StartGetOAuthTokenRequest(); |
| 847 } | 875 } |
| 848 | 876 |
| 849 void LoginUtilsImpl::FetchCookies(Profile* user_profile, | |
| 850 const GaiaAuthConsumer::ClientLoginResult& credentials) { | |
| 851 if (!using_oauth_) { | |
| 852 // Take the credentials passed in and try to exchange them for | |
| 853 // full-fledged Google authentication cookies. This is | |
| 854 // best-effort; it's possible that we'll fail due to network | |
| 855 // troubles or some such. | |
| 856 // CookieFetcher will delete itself once done. | |
| 857 CookieFetcher* cf = new CookieFetcher(user_profile); | |
| 858 cf->AttemptFetch(credentials.data); | |
| 859 } else { | |
| 860 UserSessionCookieFetcher* cf = | |
| 861 new UserSessionCookieFetcher(user_profile); | |
| 862 cf->Start(credentials); | |
| 863 } | |
| 864 } | |
| 865 | |
| 866 void LoginUtilsImpl::StartTokenServices(Profile* user_profile) { | 877 void LoginUtilsImpl::StartTokenServices(Profile* user_profile) { |
| 867 std::string oauth1_token; | 878 std::string oauth1_token; |
| 868 std::string oauth1_secret; | 879 std::string oauth1_secret; |
| 869 if (!ReadOAuth1AccessToken(user_profile, &oauth1_token, &oauth1_secret)) | 880 if (!ReadOAuth1AccessToken(user_profile, &oauth1_token, &oauth1_secret)) |
| 870 return; | 881 return; |
| 871 | 882 |
| 872 FetchSecondaryTokens(user_profile->GetOffTheRecordProfile(), oauth1_token, | 883 FetchSecondaryTokens(user_profile->GetOffTheRecordProfile(), oauth1_token, |
| 873 oauth1_secret); | 884 oauth1_secret); |
| 874 } | 885 } |
| 875 | 886 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 // Kick off verification of OAuth1 access token (via OAuthLogin), this should | 1249 // Kick off verification of OAuth1 access token (via OAuthLogin), this should |
| 1239 // let us fetch credentials that will be used to initialize sync engine. | 1250 // let us fetch credentials that will be used to initialize sync engine. |
| 1240 FetchCredentials(user_profile, token, secret); | 1251 FetchCredentials(user_profile, token, secret); |
| 1241 | 1252 |
| 1242 FetchSecondaryTokens(user_profile->GetOffTheRecordProfile(), token, secret); | 1253 FetchSecondaryTokens(user_profile->GetOffTheRecordProfile(), token, secret); |
| 1243 } | 1254 } |
| 1244 | 1255 |
| 1245 void LoginUtilsImpl::FetchCredentials(Profile* user_profile, | 1256 void LoginUtilsImpl::FetchCredentials(Profile* user_profile, |
| 1246 const std::string& token, | 1257 const std::string& token, |
| 1247 const std::string& secret) { | 1258 const std::string& secret) { |
| 1248 oauth_login_verifier_.reset(new OAuthLoginVerifier(user_profile, | 1259 oauth_login_verifier_.reset(new OAuthLoginVerifier(this, |
| 1260 user_profile, | |
| 1249 token, | 1261 token, |
| 1250 secret, | 1262 secret, |
| 1251 username_)); | 1263 username_)); |
| 1252 oauth_login_verifier_->Start(); | 1264 oauth_login_verifier_->StartOAuthVerification(); |
| 1253 } | 1265 } |
| 1254 | 1266 |
| 1255 | 1267 |
| 1256 void LoginUtilsImpl::FetchPolicyToken(Profile* offrecord_profile, | 1268 void LoginUtilsImpl::FetchPolicyToken(Profile* offrecord_profile, |
| 1257 const std::string& token, | 1269 const std::string& token, |
| 1258 const std::string& secret) { | 1270 const std::string& secret) { |
| 1259 // Fetch dm service token now, if it hasn't been fetched yet. | 1271 // Fetch dm service token now, if it hasn't been fetched yet. |
| 1260 if (!policy_oauth_fetcher_.get() || policy_oauth_fetcher_->failed()) { | 1272 if (!policy_oauth_fetcher_.get() || policy_oauth_fetcher_->failed()) { |
| 1261 // Trigger oauth token fetch for user policy. | 1273 // Trigger oauth token fetch for user policy. |
| 1262 policy_oauth_fetcher_.reset(new PolicyOAuthFetcher(offrecord_profile, | 1274 policy_oauth_fetcher_.reset(new PolicyOAuthFetcher(offrecord_profile, |
| 1263 token, | 1275 token, |
| 1264 secret)); | 1276 secret)); |
| 1265 policy_oauth_fetcher_->Start(); | 1277 policy_oauth_fetcher_->Start(); |
| 1266 } | 1278 } |
| 1267 | 1279 |
| 1268 // TODO(zelidrag): We should add initialization of other services somewhere | 1280 // TODO(zelidrag): We should add initialization of other services somewhere |
| 1269 // here as well. This could be handled with TokenService class once it is | 1281 // here as well. This could be handled with TokenService class once it is |
| 1270 // ready to handle OAuth tokens. | 1282 // ready to handle OAuth tokens. |
| 1271 | 1283 |
| 1272 // We don't need authenticator instance any more, reset it so that | 1284 // We don't need authenticator instance any more, reset it so that |
| 1273 // ScreenLocker would create a separate instance. | 1285 // ScreenLocker would create a separate instance. |
| 1274 // TODO(nkostylev): There's a potential race if SL would be created before | 1286 // TODO(nkostylev): There's a potential race if SL would be created before |
| 1275 // OAuth tokens are fetched. It would use incorrect Authenticator instance. | 1287 // OAuth tokens are fetched. It would use incorrect Authenticator instance. |
| 1276 authenticator_ = NULL; | 1288 authenticator_ = NULL; |
| 1277 } | 1289 } |
| 1278 | 1290 |
| 1291 void LoginUtilsImpl::OnOAuthVerificationFailed(const std::string& user_name) { | |
| 1292 UserManager::Get()->SaveUserOAuthStatus(user_name, | |
| 1293 User::OAUTH_TOKEN_STATUS_INVALID); | |
| 1294 } | |
| 1295 | |
| 1296 void LoginUtilsImpl::OnOAuthVerificationSucceeded( | |
| 1297 const std::string& user_name, const std::string& sid, | |
| 1298 const std::string& lsid, const std::string& auth) { | |
| 1299 // Kick off sync engine. | |
| 1300 GaiaAuthConsumer::ClientLoginResult credentials(sid, lsid, auth, | |
| 1301 std::string()); | |
| 1302 StartSync(ProfileManager::GetDefaultProfile(), credentials); | |
| 1303 } | |
| 1304 | |
| 1305 | |
| 1279 void LoginUtilsImpl::OnOnlineStateChanged(bool online) { | 1306 void LoginUtilsImpl::OnOnlineStateChanged(bool online) { |
| 1280 // If we come online for the first time after successful offline login, | 1307 // If we come online for the first time after successful offline login, |
| 1281 // we need to kick of OAuth token verification process again. | 1308 // we need to kick of OAuth token verification process again. |
| 1282 if (UserManager::Get()->user_is_logged_in() && | 1309 if (online && UserManager::Get()->user_is_logged_in() && |
| 1283 UserManager::Get()->offline_login() && online) { | 1310 oauth_login_verifier_.get() && |
| 1284 KickStartAuthentication(ProfileManager::GetDefaultProfile()); | 1311 !oauth_login_verifier_->is_done()) { |
| 1312 oauth_login_verifier_->ContinueVerification(); | |
| 1285 } | 1313 } |
| 1286 } | 1314 } |
| 1287 | 1315 |
| 1288 LoginUtils* LoginUtils::Get() { | 1316 LoginUtils* LoginUtils::Get() { |
| 1289 return LoginUtilsWrapper::GetInstance()->get(); | 1317 return LoginUtilsWrapper::GetInstance()->get(); |
| 1290 } | 1318 } |
| 1291 | 1319 |
| 1292 void LoginUtils::Set(LoginUtils* mock) { | 1320 void LoginUtils::Set(LoginUtils* mock) { |
| 1293 LoginUtilsWrapper::GetInstance()->reset(mock); | 1321 LoginUtilsWrapper::GetInstance()->reset(mock); |
| 1294 } | 1322 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1315 // Mark login host for deletion after browser starts. This | 1343 // Mark login host for deletion after browser starts. This |
| 1316 // guarantees that the message loop will be referenced by the | 1344 // guarantees that the message loop will be referenced by the |
| 1317 // browser before it is dereferenced by the login host. | 1345 // browser before it is dereferenced by the login host. |
| 1318 if (login_host) { | 1346 if (login_host) { |
| 1319 login_host->OnSessionStart(); | 1347 login_host->OnSessionStart(); |
| 1320 login_host = NULL; | 1348 login_host = NULL; |
| 1321 } | 1349 } |
| 1322 } | 1350 } |
| 1323 | 1351 |
| 1324 } // namespace chromeos | 1352 } // namespace chromeos |
| OLD | NEW |