Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: components/signin/core/browser/account_tracker_service.cc

Issue 1245103005: Componentize more signin code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
11 #include "base/profiler/scoped_tracker.h" 11 #include "base/profiler/scoped_tracker.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "components/pref_registry/pref_registry_syncable.h"
15 #include "components/signin/core/browser/signin_client.h" 16 #include "components/signin/core/browser/signin_client.h"
16 #include "components/signin/core/browser/signin_manager.h" 17 #include "components/signin/core/browser/signin_manager.h"
17 #include "components/signin/core/common/signin_pref_names.h" 18 #include "components/signin/core/common/signin_pref_names.h"
18 19
19 namespace { 20 namespace {
20 21
21 const char kAccountKeyPath[] = "account_id"; 22 const char kAccountKeyPath[] = "account_id";
22 const char kAccountEmailPath[] = "email"; 23 const char kAccountEmailPath[] = "email";
23 const char kAccountGaiaPath[] = "gaia"; 24 const char kAccountGaiaPath[] = "gaia";
24 const char kAccountHostedDomainPath[] = "hd"; 25 const char kAccountHostedDomainPath[] = "hd";
(...skipping 22 matching lines...) Expand all
47 48
48 49
49 const char AccountTrackerService::kAccountInfoPref[] = "account_info"; 50 const char AccountTrackerService::kAccountInfoPref[] = "account_info";
50 51
51 AccountTrackerService::AccountTrackerService() 52 AccountTrackerService::AccountTrackerService()
52 : signin_client_(NULL) {} 53 : signin_client_(NULL) {}
53 54
54 AccountTrackerService::~AccountTrackerService() { 55 AccountTrackerService::~AccountTrackerService() {
55 } 56 }
56 57
58 // static
59 void AccountTrackerService::RegisterPrefs(
60 user_prefs::PrefRegistrySyncable* registry) {
61 registry->RegisterListPref(AccountTrackerService::kAccountInfoPref);
62 registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
63 AccountTrackerService::MIGRATION_NOT_STARTED);
64 }
65
57 void AccountTrackerService::Initialize(SigninClient* signin_client) { 66 void AccountTrackerService::Initialize(SigninClient* signin_client) {
58 DCHECK(signin_client); 67 DCHECK(signin_client);
59 DCHECK(!signin_client_); 68 DCHECK(!signin_client_);
60 signin_client_ = signin_client; 69 signin_client_ = signin_client;
61 LoadFromPrefs(); 70 LoadFromPrefs();
62 } 71 }
63 72
64 void AccountTrackerService::Shutdown() { 73 void AccountTrackerService::Shutdown() {
65 } 74 }
66 75
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 if(!ContainsKey(accounts_, info.account_id)) { 406 if(!ContainsKey(accounts_, info.account_id)) {
398 SeedAccountInfo(info.gaia, info.email); 407 SeedAccountInfo(info.gaia, info.email);
399 } 408 }
400 409
401 AccountState& state = accounts_[info.account_id]; 410 AccountState& state = accounts_[info.account_id];
402 state.info = info; 411 state.info = info;
403 NotifyAccountUpdated(state); 412 NotifyAccountUpdated(state);
404 SaveToPrefs(state); 413 SaveToPrefs(state);
405 } 414 }
406 } 415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698