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

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

Issue 216703002: Move the SigninProcess APIs from SigninManager to ChromeSigninClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove cruft Created 6 years, 9 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
« no previous file with comments | « chrome/browser/signin/signin_browsertest.cc ('k') | chrome/browser/signin/signin_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. See SigninManagerBase for full description of 6 // which user is signed in. See SigninManagerBase for full description of
7 // responsibilities. The class defined in this file provides functionality 7 // responsibilities. The class defined in this file provides functionality
8 // required by all platforms except Chrome OS. 8 // required by all platforms except Chrome OS.
9 // 9 //
10 // When a user is signed in, a ClientLogin request is run on their behalf. 10 // When a user is signed in, a ClientLogin request is run on their behalf.
(...skipping 17 matching lines...) Expand all
28 #include "base/gtest_prod_util.h" 28 #include "base/gtest_prod_util.h"
29 #include "base/logging.h" 29 #include "base/logging.h"
30 #include "base/memory/scoped_ptr.h" 30 #include "base/memory/scoped_ptr.h"
31 #include "base/observer_list.h" 31 #include "base/observer_list.h"
32 #include "base/prefs/pref_change_registrar.h" 32 #include "base/prefs/pref_change_registrar.h"
33 #include "base/prefs/pref_member.h" 33 #include "base/prefs/pref_member.h"
34 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
35 #include "components/keyed_service/core/keyed_service.h" 35 #include "components/keyed_service/core/keyed_service.h"
36 #include "components/signin/core/browser/signin_internals_util.h" 36 #include "components/signin/core/browser/signin_internals_util.h"
37 #include "components/signin/core/browser/signin_manager_base.h" 37 #include "components/signin/core/browser/signin_manager_base.h"
38 #include "content/public/browser/render_process_host_observer.h"
39 #include "google_apis/gaia/google_service_auth_error.h" 38 #include "google_apis/gaia/google_service_auth_error.h"
40 #include "google_apis/gaia/merge_session_helper.h" 39 #include "google_apis/gaia/merge_session_helper.h"
41 #include "net/cookies/canonical_cookie.h" 40 #include "net/cookies/canonical_cookie.h"
42 41
43 class PrefService; 42 class PrefService;
44 class SigninAccountIdHelper; 43 class SigninAccountIdHelper;
45 class SigninClient; 44 class SigninClient;
46 45
47 class SigninManager : public SigninManagerBase, 46 class SigninManager : public SigninManagerBase {
48 public content::RenderProcessHostObserver {
49 public: 47 public:
50 // The callback invoked once the OAuth token has been fetched during signin, 48 // The callback invoked once the OAuth token has been fetched during signin,
51 // but before the profile transitions to the "signed-in" state. This allows 49 // but before the profile transitions to the "signed-in" state. This allows
52 // callers to load policy and prompt the user appropriately before completing 50 // callers to load policy and prompt the user appropriately before completing
53 // signin. The callback is passed the just-fetched OAuth login refresh token. 51 // signin. The callback is passed the just-fetched OAuth login refresh token.
54 typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback; 52 typedef base::Callback<void(const std::string&)> OAuthTokenFetchedCallback;
55 53
56 // Returns true if |url| is a web signin URL and should be hosted in an 54 // Returns true if |url| is a web signin URL and should be hosted in an
57 // isolated, privileged signin process. 55 // isolated, privileged signin process.
58 static bool IsWebBasedSigninFlowURL(const GURL& url); 56 static bool IsWebBasedSigninFlowURL(const GURL& url);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 virtual bool IsAllowedUsername(const std::string& username) const; 112 virtual bool IsAllowedUsername(const std::string& username) const;
115 113
116 // If an authentication is in progress, return the username being 114 // If an authentication is in progress, return the username being
117 // authenticated. Returns an empty string if no auth is in progress. 115 // authenticated. Returns an empty string if no auth is in progress.
118 const std::string& GetUsernameForAuthInProgress() const; 116 const std::string& GetUsernameForAuthInProgress() const;
119 117
120 // Set the profile preference to turn off one-click sign-in so that it won't 118 // Set the profile preference to turn off one-click sign-in so that it won't
121 // ever show it again in this profile (even if the user tries a new account). 119 // ever show it again in this profile (even if the user tries a new account).
122 static void DisableOneClickSignIn(Profile* profile); 120 static void DisableOneClickSignIn(Profile* profile);
123 121
124 // content::RenderProcessHostObserver
125 virtual void RenderProcessHostDestroyed(
126 content::RenderProcessHost* host) OVERRIDE;
127
128 // Tells the SigninManager whether to prohibit signout for this profile. 122 // Tells the SigninManager whether to prohibit signout for this profile.
129 // If |prohibit_signout| is true, then signout will be prohibited. 123 // If |prohibit_signout| is true, then signout will be prohibited.
130 void ProhibitSignout(bool prohibit_signout); 124 void ProhibitSignout(bool prohibit_signout);
131 125
132 // If true, signout is prohibited for this profile (calls to SignOut() are 126 // If true, signout is prohibited for this profile (calls to SignOut() are
133 // ignored). 127 // ignored).
134 bool IsSignoutProhibited() const; 128 bool IsSignoutProhibited() const;
135 129
136 // Allows the SigninManager to track the privileged signin process
137 // identified by |host_id| so that we can later ask (via IsSigninProcess)
138 // if it is safe to sign the user in from the current context (see
139 // OneClickSigninHelper). All of this tracking state is reset once the
140 // renderer process terminates.
141 //
142 // N.B. This is the id returned by RenderProcessHost::GetID().
143 void SetSigninProcess(int host_id);
144 void ClearSigninProcess();
145 bool IsSigninProcess(int host_id) const;
146 bool HasSigninProcess() const;
147
148 // Add or remove observers for the merge session notification. 130 // Add or remove observers for the merge session notification.
149 void AddMergeSessionObserver(MergeSessionHelper::Observer* observer); 131 void AddMergeSessionObserver(MergeSessionHelper::Observer* observer);
150 void RemoveMergeSessionObserver(MergeSessionHelper::Observer* observer); 132 void RemoveMergeSessionObserver(MergeSessionHelper::Observer* observer);
151 133
152 protected: 134 protected:
153 // Pointer to parent profile (protected so FakeSigninManager can access 135 // Pointer to parent profile (protected so FakeSigninManager can access
154 // it). 136 // it).
155 Profile* profile_; 137 Profile* profile_;
156 138
157 // Flag saying whether signing out is allowed. 139 // Flag saying whether signing out is allowed.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // to one of the StartSigninXXX methods and when the sign in is either 191 // to one of the StartSigninXXX methods and when the sign in is either
210 // successful or not. 192 // successful or not.
211 SigninType type_; 193 SigninType type_;
212 194
213 // Temporarily saves the oauth2 refresh token. It will be passed to the 195 // Temporarily saves the oauth2 refresh token. It will be passed to the
214 // token service so that it does not need to mint new ones. 196 // token service so that it does not need to mint new ones.
215 std::string temp_refresh_token_; 197 std::string temp_refresh_token_;
216 198
217 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; 199 base::WeakPtrFactory<SigninManager> weak_pointer_factory_;
218 200
219 // See SetSigninProcess. Tracks the currently active signin process
220 // by ID, if there is one.
221 int signin_host_id_;
222
223 // The RenderProcessHosts being observed.
224 std::set<content::RenderProcessHost*> signin_hosts_observed_;
225
226 // The SigninClient object associated with this object. Must outlive this 201 // The SigninClient object associated with this object. Must outlive this
227 // object. 202 // object.
228 SigninClient* client_; 203 SigninClient* client_;
229 204
230 // Helper object to listen for changes to signin preferences stored in non- 205 // Helper object to listen for changes to signin preferences stored in non-
231 // profile-specific local prefs (like kGoogleServicesUsernamePattern). 206 // profile-specific local prefs (like kGoogleServicesUsernamePattern).
232 PrefChangeRegistrar local_state_pref_registrar_; 207 PrefChangeRegistrar local_state_pref_registrar_;
233 208
234 // Helper object to listen for changes to the signin allowed preference. 209 // Helper object to listen for changes to the signin allowed preference.
235 BooleanPrefMember signin_allowed_; 210 BooleanPrefMember signin_allowed_;
236 211
237 // Helper to merge signed in account into the content area. 212 // Helper to merge signed in account into the content area.
238 scoped_ptr<MergeSessionHelper> merge_session_helper_; 213 scoped_ptr<MergeSessionHelper> merge_session_helper_;
239 214
240 DISALLOW_COPY_AND_ASSIGN(SigninManager); 215 DISALLOW_COPY_AND_ASSIGN(SigninManager);
241 }; 216 };
242 217
243 #endif // !defined(OS_CHROMEOS) 218 #endif // !defined(OS_CHROMEOS)
244 219
245 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 220 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_browsertest.cc ('k') | chrome/browser/signin/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698