| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/signin/core/browser/account_tracker_service.h" | 5 #include "components/signin/core/browser/account_tracker_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 it != accounts.end(); ++it) { | 505 it != accounts.end(); ++it) { |
| 506 OnRefreshTokenAvailable(*it); | 506 OnRefreshTokenAvailable(*it); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 void AccountTrackerService::SendRefreshTokenAnnotationRequest( | 510 void AccountTrackerService::SendRefreshTokenAnnotationRequest( |
| 511 const std::string& account_id) { | 511 const std::string& account_id) { |
| 512 // We only need to send RefreshTokenAnnotationRequest from desktop platforms. | 512 // We only need to send RefreshTokenAnnotationRequest from desktop platforms. |
| 513 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 513 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 514 if (IsRefreshTokenDeviceIdExperimentEnabled() || | 514 if (IsRefreshTokenDeviceIdExperimentEnabled() || |
| 515 CommandLine::ForCurrentProcess()->HasSwitch( | 515 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 516 switches::kEnableRefreshTokenAnnotationRequest)) { | 516 switches::kEnableRefreshTokenAnnotationRequest)) { |
| 517 scoped_ptr<RefreshTokenAnnotationRequest> request = | 517 scoped_ptr<RefreshTokenAnnotationRequest> request = |
| 518 RefreshTokenAnnotationRequest::SendIfNeeded( | 518 RefreshTokenAnnotationRequest::SendIfNeeded( |
| 519 signin_client_->GetPrefs(), token_service_, signin_client_, | 519 signin_client_->GetPrefs(), token_service_, signin_client_, |
| 520 signin_client_->GetURLRequestContext(), account_id, | 520 signin_client_->GetURLRequestContext(), account_id, |
| 521 base::Bind( | 521 base::Bind( |
| 522 &AccountTrackerService::RefreshTokenAnnotationRequestDone, | 522 &AccountTrackerService::RefreshTokenAnnotationRequestDone, |
| 523 base::Unretained(this), account_id)); | 523 base::Unretained(this), account_id)); |
| 524 // If request was sent AccountTrackerService needs to own request till it | 524 // If request was sent AccountTrackerService needs to own request till it |
| 525 // finishes. | 525 // finishes. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 DCHECK(!email.empty()); | 572 DCHECK(!email.empty()); |
| 573 const std::string account_id = PickAccountIdForAccount(gaia, email); | 573 const std::string account_id = PickAccountIdForAccount(gaia, email); |
| 574 const bool already_exists = ContainsKey(accounts_, account_id); | 574 const bool already_exists = ContainsKey(accounts_, account_id); |
| 575 StartTrackingAccount(account_id); | 575 StartTrackingAccount(account_id); |
| 576 AccountState& state = accounts_[account_id]; | 576 AccountState& state = accounts_[account_id]; |
| 577 DCHECK(!already_exists || state.info.gaia == gaia); | 577 DCHECK(!already_exists || state.info.gaia == gaia); |
| 578 state.info.gaia = gaia; | 578 state.info.gaia = gaia; |
| 579 state.info.email = email; | 579 state.info.email = email; |
| 580 SaveToPrefs(state); | 580 SaveToPrefs(state); |
| 581 } | 581 } |
| OLD | NEW |