| 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 "base/profiler/scoped_tracker.h" | 5 #include "base/profiler/scoped_tracker.h" |
| 6 #include "google_apis/gaia/identity_provider.h" | 6 #include "google_apis/gaia/identity_provider.h" |
| 7 | 7 |
| 8 IdentityProvider::Observer::~Observer() {} | 8 IdentityProvider::Observer::~Observer() {} |
| 9 | 9 |
| 10 IdentityProvider::~IdentityProvider() {} | 10 IdentityProvider::~IdentityProvider() {} |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 void IdentityProvider::OnRefreshTokenAvailable(const std::string& account_id) { | 42 void IdentityProvider::OnRefreshTokenAvailable(const std::string& account_id) { |
| 43 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 43 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| 44 // fixed. | 44 // fixed. |
| 45 tracked_objects::ScopedTracker tracking_profile( | 45 tracked_objects::ScopedTracker tracking_profile( |
| 46 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 46 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 47 "422460 IdentityProvider::OnRefreshTokenAvailable")); | 47 "422460 IdentityProvider::OnRefreshTokenAvailable")); |
| 48 | 48 |
| 49 if (account_id != GetActiveAccountId()) | 49 if (account_id != GetActiveAccountId()) |
| 50 return; | 50 return; |
| 51 FOR_EACH_OBSERVER(OAuth2TokenService::Observer, | 51 for (auto& observer : token_service_observers_) |
| 52 token_service_observers_, | 52 observer.OnRefreshTokenAvailable(account_id); |
| 53 OnRefreshTokenAvailable(account_id)); | |
| 54 } | 53 } |
| 55 | 54 |
| 56 void IdentityProvider::OnRefreshTokenRevoked(const std::string& account_id) { | 55 void IdentityProvider::OnRefreshTokenRevoked(const std::string& account_id) { |
| 57 if (account_id != GetActiveAccountId()) | 56 if (account_id != GetActiveAccountId()) |
| 58 return; | 57 return; |
| 59 FOR_EACH_OBSERVER(OAuth2TokenService::Observer, | 58 for (auto& observer : token_service_observers_) |
| 60 token_service_observers_, | 59 observer.OnRefreshTokenRevoked(account_id); |
| 61 OnRefreshTokenRevoked(account_id)); | |
| 62 } | 60 } |
| 63 | 61 |
| 64 void IdentityProvider::OnRefreshTokensLoaded() { | 62 void IdentityProvider::OnRefreshTokensLoaded() { |
| 65 FOR_EACH_OBSERVER(OAuth2TokenService::Observer, | 63 for (auto& observer : token_service_observers_) |
| 66 token_service_observers_, | 64 observer.OnRefreshTokensLoaded(); |
| 67 OnRefreshTokensLoaded()); | |
| 68 } | 65 } |
| 69 | 66 |
| 70 IdentityProvider::IdentityProvider() : token_service_observer_count_(0) {} | 67 IdentityProvider::IdentityProvider() : token_service_observer_count_(0) {} |
| 71 | 68 |
| 72 void IdentityProvider::FireOnActiveAccountLogin() { | 69 void IdentityProvider::FireOnActiveAccountLogin() { |
| 73 FOR_EACH_OBSERVER(Observer, observers_, OnActiveAccountLogin()); | 70 for (auto& observer : observers_) |
| 71 observer.OnActiveAccountLogin(); |
| 74 } | 72 } |
| 75 | 73 |
| 76 void IdentityProvider::FireOnActiveAccountLogout() { | 74 void IdentityProvider::FireOnActiveAccountLogout() { |
| 77 FOR_EACH_OBSERVER(Observer, observers_, OnActiveAccountLogout()); | 75 for (auto& observer : observers_) |
| 76 observer.OnActiveAccountLogout(); |
| 78 } | 77 } |
| OLD | NEW |