| 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 "google_apis/gaia/account_tracker.h" | 5 #include "google_apis/gaia/account_tracker.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 accounts_.begin(); | 147 accounts_.begin(); |
| 148 it != accounts_.end(); | 148 it != accounts_.end(); |
| 149 ++it) { | 149 ++it) { |
| 150 DVLOG(1) << it->first << ":" << it->second.is_signed_in; | 150 DVLOG(1) << it->first << ":" << it->second.is_signed_in; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 void AccountTracker::NotifyAccountAdded(const AccountState& account) { | 155 void AccountTracker::NotifyAccountAdded(const AccountState& account) { |
| 156 DCHECK(!account.ids.gaia.empty()); | 156 DCHECK(!account.ids.gaia.empty()); |
| 157 FOR_EACH_OBSERVER( | 157 for (auto& observer : observer_list_) |
| 158 Observer, observer_list_, OnAccountAdded(account.ids)); | 158 observer.OnAccountAdded(account.ids); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void AccountTracker::NotifyAccountRemoved(const AccountState& account) { | 161 void AccountTracker::NotifyAccountRemoved(const AccountState& account) { |
| 162 DCHECK(!account.ids.gaia.empty()); | 162 DCHECK(!account.ids.gaia.empty()); |
| 163 FOR_EACH_OBSERVER( | 163 for (auto& observer : observer_list_) |
| 164 Observer, observer_list_, OnAccountRemoved(account.ids)); | 164 observer.OnAccountRemoved(account.ids); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void AccountTracker::NotifySignInChanged(const AccountState& account) { | 167 void AccountTracker::NotifySignInChanged(const AccountState& account) { |
| 168 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 168 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| 169 // fixed. | 169 // fixed. |
| 170 tracked_objects::ScopedTracker tracking_profile( | 170 tracked_objects::ScopedTracker tracking_profile( |
| 171 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 171 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 172 "422460 AccountTracker::NotifySignInChanged")); | 172 "422460 AccountTracker::NotifySignInChanged")); |
| 173 | 173 |
| 174 DCHECK(!account.ids.gaia.empty()); | 174 DCHECK(!account.ids.gaia.empty()); |
| 175 FOR_EACH_OBSERVER(Observer, | 175 for (auto& observer : observer_list_) |
| 176 observer_list_, | 176 observer.OnAccountSignInChanged(account.ids, account.is_signed_in); |
| 177 OnAccountSignInChanged(account.ids, account.is_signed_in)); | |
| 178 } | 177 } |
| 179 | 178 |
| 180 void AccountTracker::UpdateSignInState(const std::string& account_key, | 179 void AccountTracker::UpdateSignInState(const std::string& account_key, |
| 181 bool is_signed_in) { | 180 bool is_signed_in) { |
| 182 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 181 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| 183 // fixed. | 182 // fixed. |
| 184 tracked_objects::ScopedTracker tracking_profile( | 183 tracked_objects::ScopedTracker tracking_profile( |
| 185 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 184 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 186 "422460 AccountTracker::UpdateSignInState")); | 185 "422460 AccountTracker::UpdateSignInState")); |
| 187 | 186 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 "AccountIdFetcher", | 380 "AccountIdFetcher", |
| 382 this, | 381 this, |
| 383 "OnNetworkError", | 382 "OnNetworkError", |
| 384 "response_code", | 383 "response_code", |
| 385 response_code); | 384 response_code); |
| 386 LOG(ERROR) << "OnNetworkError " << response_code; | 385 LOG(ERROR) << "OnNetworkError " << response_code; |
| 387 tracker_->OnUserInfoFetchFailure(this); | 386 tracker_->OnUserInfoFetchFailure(this); |
| 388 } | 387 } |
| 389 | 388 |
| 390 } // namespace gaia | 389 } // namespace gaia |
| OLD | NEW |