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

Side by Side Diff: chrome/browser/signin/signin_manager_base.cc

Issue 71723002: This is the second CL of several that will eventually replace TokenService with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/signin/signin_manager_base.h" 5 #include "chrome/browser/signin/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"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // clear their login info also (not valid to be logged in without any 48 // clear their login info also (not valid to be logged in without any
49 // tokens). 49 // tokens).
50 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 50 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
51 if (cmd_line->HasSwitch(switches::kClearTokenService)) 51 if (cmd_line->HasSwitch(switches::kClearTokenService))
52 profile->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); 52 profile->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername);
53 53
54 std::string user = profile_->GetPrefs()->GetString( 54 std::string user = profile_->GetPrefs()->GetString(
55 prefs::kGoogleServicesUsername); 55 prefs::kGoogleServicesUsername);
56 if (!user.empty()) 56 if (!user.empty())
57 SetAuthenticatedUsername(user); 57 SetAuthenticatedUsername(user);
58
59 InitTokenService();
60 }
61
62 void SigninManagerBase::InitTokenService() {
63 // TokenService can be null for unit tests.
64 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
65 if (token_service)
66 token_service->Initialize(GaiaConstants::kChromeSource, profile_);
67 // Note: ChromeOS will kick off TokenService::LoadTokensFromDB from
68 // OAuthLoginManager once the rest of the Profile is fully initialized.
69 } 58 }
70 59
71 bool SigninManagerBase::IsInitialized() const { 60 bool SigninManagerBase::IsInitialized() const {
72 return profile_ != NULL; 61 return profile_ != NULL;
73 } 62 }
74 63
75 bool SigninManagerBase::IsSigninAllowed() const { 64 bool SigninManagerBase::IsSigninAllowed() const {
76 return profile_->GetPrefs()->GetBoolean(prefs::kSigninAllowed); 65 return profile_->GetPrefs()->GetBoolean(prefs::kSigninAllowed);
77 } 66 }
78 67
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 NotifySigninValueChanged(field, value)); 131 NotifySigninValueChanged(field, value));
143 } 132 }
144 133
145 void SigninManagerBase::NotifyDiagnosticsObservers( 134 void SigninManagerBase::NotifyDiagnosticsObservers(
146 const TimedSigninStatusField& field, 135 const TimedSigninStatusField& field,
147 const std::string& value) { 136 const std::string& value) {
148 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, 137 FOR_EACH_OBSERVER(SigninDiagnosticsObserver,
149 signin_diagnostics_observers_, 138 signin_diagnostics_observers_,
150 NotifySigninValueChanged(field, value)); 139 NotifySigninValueChanged(field, value));
151 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_base.h ('k') | chrome/browser/signin/signin_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698