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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
11 #include "base/profiler/scoped_profile.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "components/signin/core/browser/signin_manager.h" | 13 #include "components/signin/core/browser/signin_manager.h" |
14 #include "components/signin/core/common/signin_pref_names.h" | 14 #include "components/signin/core/common/signin_pref_names.h" |
15 #include "google_apis/gaia/gaia_auth_util.h" | 15 #include "google_apis/gaia/gaia_auth_util.h" |
16 #include "google_apis/gaia/gaia_constants.h" | 16 #include "google_apis/gaia/gaia_constants.h" |
17 #include "google_apis/gaia/gaia_oauth_client.h" | 17 #include "google_apis/gaia/gaia_oauth_client.h" |
18 #include "google_apis/gaia/oauth2_token_service.h" | 18 #include "google_apis/gaia/oauth2_token_service.h" |
19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
20 | 20 |
21 namespace { | 21 namespace { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 // static | 253 // static |
254 AccountTrackerService::AccountIdMigrationState | 254 AccountTrackerService::AccountIdMigrationState |
255 AccountTrackerService::GetMigrationState(PrefService* pref_service) { | 255 AccountTrackerService::GetMigrationState(PrefService* pref_service) { |
256 return static_cast<AccountTrackerService::AccountIdMigrationState>( | 256 return static_cast<AccountTrackerService::AccountIdMigrationState>( |
257 pref_service->GetInteger(prefs::kAccountIdMigrationState)); | 257 pref_service->GetInteger(prefs::kAccountIdMigrationState)); |
258 } | 258 } |
259 | 259 |
260 void AccountTrackerService::OnRefreshTokenAvailable( | 260 void AccountTrackerService::OnRefreshTokenAvailable( |
261 const std::string& account_id) { | 261 const std::string& account_id) { |
262 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. | 262 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
263 tracked_objects::ScopedProfile tracking_profile( | 263 tracked_objects::ScopedTracker tracking_profile( |
264 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 264 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
265 "422460 AccountTrackerService::OnRefreshTokenAvailable")); | 265 "422460 AccountTrackerService::OnRefreshTokenAvailable")); |
266 | 266 |
267 TRACE_EVENT1("AccountTrackerService", | 267 TRACE_EVENT1("AccountTrackerService", |
268 "AccountTracker::OnRefreshTokenAvailable", | 268 "AccountTracker::OnRefreshTokenAvailable", |
269 "account_id", | 269 "account_id", |
270 account_id); | 270 account_id); |
271 DVLOG(1) << "AVAILABLE " << account_id; | 271 DVLOG(1) << "AVAILABLE " << account_id; |
272 | 272 |
273 StartTrackingAccount(account_id); | 273 StartTrackingAccount(account_id); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 DCHECK(!email.empty()); | 481 DCHECK(!email.empty()); |
482 const std::string account_id = PickAccountIdForAccount(gaia, email); | 482 const std::string account_id = PickAccountIdForAccount(gaia, email); |
483 const bool already_exists = ContainsKey(accounts_, account_id); | 483 const bool already_exists = ContainsKey(accounts_, account_id); |
484 StartTrackingAccount(account_id); | 484 StartTrackingAccount(account_id); |
485 AccountState& state = accounts_[account_id]; | 485 AccountState& state = accounts_[account_id]; |
486 DCHECK(!already_exists || state.info.gaia == gaia); | 486 DCHECK(!already_exists || state.info.gaia == gaia); |
487 state.info.gaia = gaia; | 487 state.info.gaia = gaia; |
488 state.info.email = email; | 488 state.info.email = email; |
489 SaveToPrefs(state); | 489 SaveToPrefs(state); |
490 } | 490 } |
OLD | NEW |