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

Side by Side Diff: components/signin/core/browser/signin_manager.h

Issue 2953253002: [DICE] Enable sync for an account that is already present in the token service. (Closed)
Patch Set: Address code review Created 3 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 // 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ProfileOAuth2TokenService* token_service, 67 ProfileOAuth2TokenService* token_service,
68 AccountTrackerService* account_tracker_service, 68 AccountTrackerService* account_tracker_service,
69 GaiaCookieManagerService* cookie_manager_service); 69 GaiaCookieManagerService* cookie_manager_service);
70 ~SigninManager() override; 70 ~SigninManager() override;
71 71
72 // Returns true if the username is allowed based on the policy string. 72 // Returns true if the username is allowed based on the policy string.
73 static bool IsUsernameAllowedByPolicy(const std::string& username, 73 static bool IsUsernameAllowedByPolicy(const std::string& username,
74 const std::string& policy); 74 const std::string& policy);
75 75
76 // Attempt to sign in this user with a refresh token. 76 // Attempt to sign in this user with a refresh token.
77 // If |refresh_token| is not empty, then SigninManager will add it to the
78 // |token_service_| when the sign-in flow is completed.
77 // If non-null, the passed |oauth_fetched_callback| callback is invoked once 79 // If non-null, the passed |oauth_fetched_callback| callback is invoked once
78 // signin has been completed. 80 // sign-in has been completed.
79 // The callback should invoke SignOut() or CompletePendingSignin() to either 81 // The callback should invoke SignOut() or CompletePendingSignin() to either
80 // continue or cancel the in-process signin. 82 // continue or cancel the in-process signin.
81 virtual void StartSignInWithRefreshToken( 83 virtual void StartSignInWithRefreshToken(
82 const std::string& refresh_token, 84 const std::string& refresh_token,
83 const std::string& gaia_id, 85 const std::string& gaia_id,
84 const std::string& username, 86 const std::string& username,
85 const std::string& password, 87 const std::string& password,
86 const OAuthTokenFetchedCallback& oauth_fetched_callback); 88 const OAuthTokenFetchedCallback& oauth_fetched_callback);
87 89
88 // Copies auth credentials from one SigninManager to this one. This is used 90 // Copies auth credentials from one SigninManager to this one. This is used
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 147
146 protected: 148 protected:
147 // Flag saying whether signing out is allowed. 149 // Flag saying whether signing out is allowed.
148 bool prohibit_signout_; 150 bool prohibit_signout_;
149 151
150 // The sign out process which is started by SigninClient::PreSignOut() 152 // The sign out process which is started by SigninClient::PreSignOut()
151 virtual void DoSignOut(signin_metrics::ProfileSignout signout_source_metric, 153 virtual void DoSignOut(signin_metrics::ProfileSignout signout_source_metric,
152 signin_metrics::SignoutDelete signout_delete_metric); 154 signin_metrics::SignoutDelete signout_delete_metric);
153 155
154 private: 156 private:
155 enum SigninType { SIGNIN_TYPE_NONE, SIGNIN_TYPE_WITH_REFRESH_TOKEN }; 157 enum SigninType {
158 SIGNIN_TYPE_NONE,
159 SIGNIN_TYPE_WITH_REFRESH_TOKEN,
160 SIGNIN_TYPE_WITHOUT_REFRESH_TOKEN
161 };
156 162
157 std::string SigninTypeToString(SigninType type); 163 std::string SigninTypeToString(SigninType type);
158 friend class FakeSigninManager; 164 friend class FakeSigninManager;
159 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); 165 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData);
160 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); 166 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess);
161 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); 167 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure);
162 168
163 // If user was signed in, load tokens from DB if available. 169 // If user was signed in, load tokens from DB if available.
164 void InitTokenService(); 170 void InitTokenService();
165 171
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 bool user_info_fetched_by_account_tracker_; 247 bool user_info_fetched_by_account_tracker_;
242 248
243 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; 249 base::WeakPtrFactory<SigninManager> weak_pointer_factory_;
244 250
245 DISALLOW_COPY_AND_ASSIGN(SigninManager); 251 DISALLOW_COPY_AND_ASSIGN(SigninManager);
246 }; 252 };
247 253
248 #endif // !defined(OS_CHROMEOS) 254 #endif // !defined(OS_CHROMEOS)
249 255
250 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_H_ 256 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698