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

Side by Side Diff: chrome/browser/signin/signin_manager.h

Issue 12077030: Allow signin to continue even if sync is disabled by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows sync integration test failure Created 7 years, 10 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 | 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 // The signin manager encapsulates some functionality tracking 5 // The signin manager encapsulates some functionality tracking
6 // which user is signed in. When a user is signed in, a ClientLogin 6 // which user is signed in. When a user is signed in, a ClientLogin
7 // request is run on their behalf. Auth tokens are fetched from Google 7 // request is run on their behalf. Auth tokens are fetched from Google
8 // and the results are stored in the TokenService. 8 // and the results are stored in the TokenService.
9 // 9 //
10 // **NOTE** on semantics of SigninManager: 10 // **NOTE** on semantics of SigninManager:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void Initialize(Profile* profile); 84 void Initialize(Profile* profile);
85 bool IsInitialized() const; 85 bool IsInitialized() const;
86 86
87 // Returns true if the passed username is allowed by policy. Virtual for 87 // Returns true if the passed username is allowed by policy. Virtual for
88 // mocking in tests. 88 // mocking in tests.
89 virtual bool IsAllowedUsername(const std::string& username) const; 89 virtual bool IsAllowedUsername(const std::string& username) const;
90 90
91 // If a user has previously established a username and SignOut has not been 91 // If a user has previously established a username and SignOut has not been
92 // called, this will return the username. 92 // called, this will return the username.
93 // Otherwise, it will return an empty string. 93 // Otherwise, it will return an empty string.
94 const std::string& GetAuthenticatedUsername(); 94 const std::string& GetAuthenticatedUsername() const;
95 95
96 // Sets the user name. Note: |username| should be already authenticated as 96 // Sets the user name. Note: |username| should be already authenticated as
97 // this is a sticky operation (in contrast to StartSignIn). 97 // this is a sticky operation (in contrast to StartSignIn).
98 // TODO(tim): Remove this in favor of passing username on construction by 98 // TODO(tim): Remove this in favor of passing username on construction by
99 // (by platform / depending on StartBehavior). Bug 88109. 99 // (by platform / depending on StartBehavior). Bug 88109.
100 void SetAuthenticatedUsername(const std::string& username); 100 void SetAuthenticatedUsername(const std::string& username);
101 101
102 // Attempt to sign in this user with ClientLogin. If successful, set a 102 // Attempt to sign in this user with ClientLogin. If successful, set a
103 // preference indicating the signed in user and send out a notification, 103 // preference indicating the signed in user and send out a notification,
104 // then start fetching tokens for the user. 104 // then start fetching tokens for the user.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // content::NotificationObserver 165 // content::NotificationObserver
166 virtual void Observe(int type, 166 virtual void Observe(int type,
167 const content::NotificationSource& source, 167 const content::NotificationSource& source,
168 const content::NotificationDetails& details) OVERRIDE; 168 const content::NotificationDetails& details) OVERRIDE;
169 169
170 SigninGlobalError* signin_global_error() { 170 SigninGlobalError* signin_global_error() {
171 return signin_global_error_.get(); 171 return signin_global_error_.get();
172 } 172 }
173 173
174 const SigninGlobalError* signin_global_error() const {
175 return signin_global_error_.get();
176 }
177
174 // ProfileKeyedService implementation. 178 // ProfileKeyedService implementation.
175 virtual void Shutdown() OVERRIDE; 179 virtual void Shutdown() OVERRIDE;
176 180
177 protected: 181 protected:
178 // Weak pointer to parent profile (protected so FakeSigninManager can access 182 // Weak pointer to parent profile (protected so FakeSigninManager can access
179 // it). 183 // it).
180 Profile* profile_; 184 Profile* profile_;
181 185
182 // Used to show auth errors in the wrench menu. The SigninGlobalError is 186 // Used to show auth errors in the wrench menu. The SigninGlobalError is
183 // different than most GlobalErrors in that its lifetime is controlled by 187 // different than most GlobalErrors in that its lifetime is controlled by
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // to one of the StartSigninXXX methods and when the sign in is either 270 // to one of the StartSigninXXX methods and when the sign in is either
267 // successful or not. 271 // successful or not.
268 SigninType type_; 272 SigninType type_;
269 273
270 // Temporarily saves the oauth2 refresh and access tokens when signing in 274 // Temporarily saves the oauth2 refresh and access tokens when signing in
271 // with credentials. These will be passed to TokenService so that it does 275 // with credentials. These will be passed to TokenService so that it does
272 // not need to mint new ones. 276 // not need to mint new ones.
273 ClientOAuthResult temp_oauth_login_tokens_; 277 ClientOAuthResult temp_oauth_login_tokens_;
274 278
275 // The list of SigninDiagnosticObservers. 279 // The list of SigninDiagnosticObservers.
276 ObserverList<signin_internals_util::SigninDiagnosticsObserver> 280 ObserverList<signin_internals_util::SigninDiagnosticsObserver, true>
277 signin_diagnostics_observers_; 281 signin_diagnostics_observers_;
278 282
279 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; 283 base::WeakPtrFactory<SigninManager> weak_pointer_factory_;
280 284
281 DISALLOW_COPY_AND_ASSIGN(SigninManager); 285 DISALLOW_COPY_AND_ASSIGN(SigninManager);
282 }; 286 };
283 287
284 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 288 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_global_error_unittest.cc ('k') | chrome/browser/signin/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698