| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/profiler/scoped_profile.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/signin/core/browser/signin_manager.h" | 12 #include "components/signin/core/browser/signin_manager.h" |
| 12 #include "components/signin/core/common/signin_pref_names.h" | 13 #include "components/signin/core/common/signin_pref_names.h" |
| 13 #include "google_apis/gaia/gaia_auth_util.h" | 14 #include "google_apis/gaia/gaia_auth_util.h" |
| 14 #include "google_apis/gaia/gaia_constants.h" | 15 #include "google_apis/gaia/gaia_constants.h" |
| 15 #include "google_apis/gaia/gaia_oauth_client.h" | 16 #include "google_apis/gaia/gaia_oauth_client.h" |
| 16 #include "google_apis/gaia/oauth2_token_service.h" | 17 #include "google_apis/gaia/oauth2_token_service.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 251 |
| 251 // static | 252 // static |
| 252 AccountTrackerService::AccountIdMigrationState | 253 AccountTrackerService::AccountIdMigrationState |
| 253 AccountTrackerService::GetMigrationState(PrefService* pref_service) { | 254 AccountTrackerService::GetMigrationState(PrefService* pref_service) { |
| 254 return static_cast<AccountTrackerService::AccountIdMigrationState>( | 255 return static_cast<AccountTrackerService::AccountIdMigrationState>( |
| 255 pref_service->GetInteger(prefs::kAccountIdMigrationState)); | 256 pref_service->GetInteger(prefs::kAccountIdMigrationState)); |
| 256 } | 257 } |
| 257 | 258 |
| 258 void AccountTrackerService::OnRefreshTokenAvailable( | 259 void AccountTrackerService::OnRefreshTokenAvailable( |
| 259 const std::string& account_id) { | 260 const std::string& account_id) { |
| 261 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. |
| 262 tracked_objects::ScopedProfile tracking_profile( |
| 263 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 264 "422460 AccountTrackerService::OnRefreshTokenAvailable")); |
| 265 |
| 260 TRACE_EVENT1("AccountTrackerService", | 266 TRACE_EVENT1("AccountTrackerService", |
| 261 "AccountTracker::OnRefreshTokenAvailable", | 267 "AccountTracker::OnRefreshTokenAvailable", |
| 262 "account_id", | 268 "account_id", |
| 263 account_id); | 269 account_id); |
| 264 DVLOG(1) << "AVAILABLE " << account_id; | 270 DVLOG(1) << "AVAILABLE " << account_id; |
| 265 | 271 |
| 266 StartTrackingAccount(account_id); | 272 StartTrackingAccount(account_id); |
| 267 AccountState& state = accounts_[account_id]; | 273 AccountState& state = accounts_[account_id]; |
| 268 | 274 |
| 269 if (state.info.gaia.empty()) | 275 if (state.info.gaia.empty()) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 441 } |
| 436 } | 442 } |
| 437 | 443 |
| 438 void AccountTrackerService::LoadFromTokenService() { | 444 void AccountTrackerService::LoadFromTokenService() { |
| 439 std::vector<std::string> accounts = token_service_->GetAccounts(); | 445 std::vector<std::string> accounts = token_service_->GetAccounts(); |
| 440 for (std::vector<std::string>::const_iterator it = accounts.begin(); | 446 for (std::vector<std::string>::const_iterator it = accounts.begin(); |
| 441 it != accounts.end(); ++it) { | 447 it != accounts.end(); ++it) { |
| 442 OnRefreshTokenAvailable(*it); | 448 OnRefreshTokenAvailable(*it); |
| 443 } | 449 } |
| 444 } | 450 } |
| OLD | NEW |