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

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

Issue 1257623002: Componentize FakeSigninManager and SigninManager prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment 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
« no previous file with comments | « components/signin/core/browser/signin_manager_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin_manager_base.h" 5 #include "components/signin/core/browser/signin_manager_base.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "components/pref_registry/pref_registry_syncable.h"
16 #include "components/signin/core/browser/account_tracker_service.h" 17 #include "components/signin/core/browser/account_tracker_service.h"
17 #include "components/signin/core/browser/signin_client.h" 18 #include "components/signin/core/browser/signin_client.h"
18 #include "components/signin/core/common/signin_pref_names.h" 19 #include "components/signin/core/common/signin_pref_names.h"
19 #include "components/signin/core/common/signin_switches.h" 20 #include "components/signin/core/common/signin_switches.h"
20 #include "google_apis/gaia/gaia_auth_util.h" 21 #include "google_apis/gaia/gaia_auth_util.h"
21 #include "google_apis/gaia/gaia_constants.h" 22 #include "google_apis/gaia/gaia_constants.h"
22 #include "google_apis/gaia/gaia_urls.h" 23 #include "google_apis/gaia/gaia_urls.h"
23 24
24 using namespace signin_internals_util; 25 using namespace signin_internals_util;
25 26
26 SigninManagerBase::SigninManagerBase( 27 SigninManagerBase::SigninManagerBase(
27 SigninClient* client, 28 SigninClient* client,
28 AccountTrackerService* account_tracker_service) 29 AccountTrackerService* account_tracker_service)
29 : client_(client), 30 : client_(client),
30 account_tracker_service_(account_tracker_service), 31 account_tracker_service_(account_tracker_service),
31 initialized_(false), 32 initialized_(false),
32 weak_pointer_factory_(this) { 33 weak_pointer_factory_(this) {
33 DCHECK(client_); 34 DCHECK(client_);
34 DCHECK(account_tracker_service_); 35 DCHECK(account_tracker_service_);
35 } 36 }
36 37
37 SigninManagerBase::~SigninManagerBase() {} 38 SigninManagerBase::~SigninManagerBase() {}
38 39
40 // static
41 void SigninManagerBase::RegisterProfilePrefs(
42 user_prefs::PrefRegistrySyncable* registry) {
43 registry->RegisterStringPref(prefs::kGoogleServicesHostedDomain,
44 std::string());
45 registry->RegisterStringPref(prefs::kGoogleServicesLastUsername,
46 std::string());
47 registry->RegisterInt64Pref(
48 prefs::kGoogleServicesRefreshTokenAnnotateScheduledTime,
49 base::Time().ToInternalValue());
50 registry->RegisterStringPref(prefs::kGoogleServicesSigninScopedDeviceId,
51 std::string());
52 registry->RegisterStringPref(prefs::kGoogleServicesAccountId, std::string());
53 registry->RegisterStringPref(prefs::kGoogleServicesUserAccountId,
54 std::string());
55 registry->RegisterBooleanPref(prefs::kAutologinEnabled, true);
56 registry->RegisterBooleanPref(prefs::kReverseAutologinEnabled, true);
57 registry->RegisterListPref(prefs::kReverseAutologinRejectedEmailList,
58 new base::ListValue);
59 registry->RegisterInt64Pref(prefs::kSignedInTime,
60 base::Time().ToInternalValue());
61
62 // Deprecated prefs: will be removed in a future release.
63 registry->RegisterStringPref(prefs::kGoogleServicesUsername, std::string());
64 }
65
66 // static
67 void SigninManagerBase::RegisterPrefs(PrefRegistrySimple* registry) {
68 registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern,
69 std::string());
70 }
71
39 void SigninManagerBase::Initialize(PrefService* local_state) { 72 void SigninManagerBase::Initialize(PrefService* local_state) {
40 // Should never call Initialize() twice. 73 // Should never call Initialize() twice.
41 DCHECK(!IsInitialized()); 74 DCHECK(!IsInitialized());
42 initialized_ = true; 75 initialized_ = true;
43 76
44 // If the user is clearing the token service from the command line, then 77 // If the user is clearing the token service from the command line, then
45 // clear their login info also (not valid to be logged in without any 78 // clear their login info also (not valid to be logged in without any
46 // tokens). 79 // tokens).
47 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 80 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
48 if (cmd_line->HasSwitch(switches::kClearTokenService)) { 81 if (cmd_line->HasSwitch(switches::kClearTokenService)) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 signin_diagnostics_observers_.RemoveObserver(observer); 226 signin_diagnostics_observers_.RemoveObserver(observer);
194 } 227 }
195 228
196 void SigninManagerBase::NotifyDiagnosticsObservers( 229 void SigninManagerBase::NotifyDiagnosticsObservers(
197 const TimedSigninStatusField& field, 230 const TimedSigninStatusField& field,
198 const std::string& value) { 231 const std::string& value) {
199 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, 232 FOR_EACH_OBSERVER(SigninDiagnosticsObserver,
200 signin_diagnostics_observers_, 233 signin_diagnostics_observers_,
201 NotifySigninValueChanged(field, value)); 234 NotifySigninValueChanged(field, value));
202 } 235 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/signin_manager_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698