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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.h

Issue 777143003: Clean up straggler classes to use embedded signin in page in the new profiles world. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years 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 (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 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 StartSyncArgs(); 95 StartSyncArgs();
96 StartSyncArgs(Profile* profile, 96 StartSyncArgs(Profile* profile,
97 Browser* browser, 97 Browser* browser,
98 OneClickSigninHelper::AutoAccept auto_accept, 98 OneClickSigninHelper::AutoAccept auto_accept,
99 const std::string& session_index, 99 const std::string& session_index,
100 const std::string& email, 100 const std::string& email,
101 const std::string& password, 101 const std::string& password,
102 const std::string& refresh_token, 102 const std::string& refresh_token,
103 content::WebContents* web_contents, 103 content::WebContents* web_contents,
104 bool untrusted_confirmation_required, 104 bool untrusted_confirmation_required,
105 signin::Source source, 105 signin_metrics::Source source,
106 OneClickSigninSyncStarter::Callback callback); 106 OneClickSigninSyncStarter::Callback callback);
107 ~StartSyncArgs(); 107 ~StartSyncArgs();
108 108
109 Profile* profile; 109 Profile* profile;
110 Browser* browser; 110 Browser* browser;
111 OneClickSigninHelper::AutoAccept auto_accept; 111 OneClickSigninHelper::AutoAccept auto_accept;
112 std::string session_index; 112 std::string session_index;
113 std::string email; 113 std::string email;
114 std::string password; 114 std::string password;
115 std::string refresh_token; 115 std::string refresh_token;
116 116
117 // Web contents in which the sync setup page should be displayed, 117 // Web contents in which the sync setup page should be displayed,
118 // if necessary. Can be NULL. 118 // if necessary. Can be NULL.
119 content::WebContents* web_contents; 119 content::WebContents* web_contents;
120 120
121 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required; 121 OneClickSigninSyncStarter::ConfirmationRequired confirmation_required;
122 signin::Source source; 122 signin_metrics::Source source;
123 OneClickSigninSyncStarter::Callback callback; 123 OneClickSigninSyncStarter::Callback callback;
124 }; 124 };
125 125
126 // Wrapper to call OneClickSigninSyncStarter after fetching the refresh token 126 // Wrapper to call OneClickSigninSyncStarter after fetching the refresh token
127 // if needed. Also verifies that the cookies are correct if no password is 127 // if needed. Also verifies that the cookies are correct if no password is
128 // specified, and checks that the email from the cookies match the expected 128 // specified, and checks that the email from the cookies match the expected
129 // email address. 129 // email address.
130 class SyncStarterWrapper : public SigninOAuthHelper::Consumer, 130 class SyncStarterWrapper : public SigninOAuthHelper::Consumer,
131 public chrome::BrowserListObserver { 131 public chrome::BrowserListObserver {
132 public: 132 public:
(...skipping 29 matching lines...) Expand all
162 162
163 OneClickSigninHelper::StartSyncArgs args_; 163 OneClickSigninHelper::StartSyncArgs args_;
164 chrome::HostDesktopType desktop_type_; 164 chrome::HostDesktopType desktop_type_;
165 OneClickSigninSyncStarter::StartSyncMode start_mode_; 165 OneClickSigninSyncStarter::StartSyncMode start_mode_;
166 scoped_ptr<SigninOAuthHelper> signin_oauth_helper_; 166 scoped_ptr<SigninOAuthHelper> signin_oauth_helper_;
167 base::WeakPtrFactory<SyncStarterWrapper> weak_pointer_factory_; 167 base::WeakPtrFactory<SyncStarterWrapper> weak_pointer_factory_;
168 168
169 DISALLOW_COPY_AND_ASSIGN(SyncStarterWrapper); 169 DISALLOW_COPY_AND_ASSIGN(SyncStarterWrapper);
170 }; 170 };
171 171
172 static void LogHistogramValue(signin::Source source, int action); 172 static void LogHistogramValue(int action);
173 173
174 // Returns true if the one-click signin feature can be offered at this time. 174 // Returns true if the one-click signin feature can be offered at this time.
175 // If |email| is not empty, then the profile is checked to see if it's 175 // If |email| is not empty, then the profile is checked to see if it's
176 // already connected to a google account or if the user has already rejected 176 // already connected to a google account or if the user has already rejected
177 // one-click sign-in with this email, in which cases a one click signin 177 // one-click sign-in with this email, in which cases a one click signin
178 // should not be offered. 178 // should not be offered.
179 // 179 //
180 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the 180 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the
181 // checks that would affect the interstitial page. Otherwise, do the checks 181 // checks that would affect the interstitial page. Otherwise, do the checks
182 // that would affect the interstitial and the explicit sign ins. 182 // that would affect the interstitial and the explicit sign ins.
(...skipping 26 matching lines...) Expand all
209 // the last signed in email of the current profile, then Chrome will show a 209 // the last signed in email of the current profile, then Chrome will show a
210 // confirmation dialog before starting sync. It returns true if there is a 210 // confirmation dialog before starting sync. It returns true if there is a
211 // cross account error, and false otherwise. 211 // cross account error, and false otherwise.
212 static bool HandleCrossAccountError( 212 static bool HandleCrossAccountError(
213 Profile* profile, 213 Profile* profile,
214 const std::string& session_index, 214 const std::string& session_index,
215 const std::string& email, 215 const std::string& email,
216 const std::string& password, 216 const std::string& password,
217 const std::string& refresh_token, 217 const std::string& refresh_token,
218 OneClickSigninHelper::AutoAccept auto_accept, 218 OneClickSigninHelper::AutoAccept auto_accept,
219 signin::Source source, 219 signin_metrics::Source source,
220 OneClickSigninSyncStarter::StartSyncMode start_mode, 220 OneClickSigninSyncStarter::StartSyncMode start_mode,
221 OneClickSigninSyncStarter::Callback sync_callback); 221 OneClickSigninSyncStarter::Callback sync_callback);
222 222
223 static void RedirectToNtpOrAppsPage( 223 static void RedirectToNtpOrAppsPage(
224 content::WebContents* contents, signin::Source source); 224 content::WebContents* contents, signin_metrics::Source source);
225 225
226 // If the |source| is not settings page/webstore, redirects to 226 // If the |source| is not settings page/webstore, redirects to
227 // the NTP/Apps page. 227 // the NTP/Apps page.
228 static void RedirectToNtpOrAppsPageIfNecessary( 228 static void RedirectToNtpOrAppsPageIfNecessary(
229 content::WebContents* contents, signin::Source source); 229 content::WebContents* contents, signin_metrics::Source source);
230 230
231 // Remove the item currently at the top of the history list if it's 231 // Remove the item currently at the top of the history list if it's
232 // the Gaia redirect URL. Due to limitations of the NavigationController 232 // the Gaia redirect URL. Due to limitations of the NavigationController
233 // this cannot be done until a new page becomes "current". 233 // this cannot be done until a new page becomes "current".
234 static void RemoveSigninRedirectURLHistoryItem( 234 static void RemoveSigninRedirectURLHistoryItem(
235 content::WebContents* web_contents); 235 content::WebContents* web_contents);
236 236
237 static void LogConfirmHistogramValue(int action); 237 static void LogConfirmHistogramValue(int action);
238 238
239 private: 239 private:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // being used. 297 // being used.
298 // 298 //
299 // |continue_url| is where Gaia will continue to when the sign in process is 299 // |continue_url| is where Gaia will continue to when the sign in process is
300 // done. For explicit sign ins, this is a URL chrome controls. For one-click 300 // done. For explicit sign ins, this is a URL chrome controls. For one-click
301 // sign in, this could be any google property. This URL is used to know 301 // sign in, this could be any google property. This URL is used to know
302 // when the sign process is over and to collect infomation from the user 302 // when the sign process is over and to collect infomation from the user
303 // entered on the Gaia sign in page (for explicit sign ins). 303 // entered on the Gaia sign in page (for explicit sign ins).
304 static void ShowInfoBarUIThread(const std::string& session_index, 304 static void ShowInfoBarUIThread(const std::string& session_index,
305 const std::string& email, 305 const std::string& email,
306 AutoAccept auto_accept, 306 AutoAccept auto_accept,
307 signin::Source source, 307 signin_metrics::Source source,
308 const GURL& continue_url, 308 const GURL& continue_url,
309 int child_id, 309 int child_id,
310 int route_id); 310 int route_id);
311 311
312 void RedirectToSignin(); 312 void RedirectToSignin();
313 313
314 // Clear all data member of the helper, except for the error. 314 // Clear all data member of the helper, except for the error.
315 void CleanTransientState(); 315 void CleanTransientState();
316 316
317 // Unitests that use a TestingProfile should call this. 317 // Unitests that use a TestingProfile should call this.
(...skipping 27 matching lines...) Expand all
345 // interstitial page. It's set to true the first time we load one of those 345 // interstitial page. It's set to true the first time we load one of those
346 // pages and set to false when transient state is cleaned. 346 // pages and set to false when transient state is cleaned.
347 // Note: This should only be used for logging purposes. 347 // Note: This should only be used for logging purposes.
348 bool showing_signin_; 348 bool showing_signin_;
349 349
350 // Information about the account that has just logged in. 350 // Information about the account that has just logged in.
351 std::string session_index_; 351 std::string session_index_;
352 std::string email_; 352 std::string email_;
353 std::string password_; 353 std::string password_;
354 AutoAccept auto_accept_; 354 AutoAccept auto_accept_;
355 signin::Source source_; 355 signin_metrics::Source source_;
356 bool switched_to_advanced_; 356 bool switched_to_advanced_;
357 GURL continue_url_; 357 GURL continue_url_;
358 // The orignal continue URL after sync setup is complete. 358 // The orignal continue URL after sync setup is complete.
359 GURL original_continue_url_; 359 GURL original_continue_url_;
360 std::string error_message_; 360 std::string error_message_;
361 361
362 // Number of navigations since starting a sign in that is outside the 362 // Number of navigations since starting a sign in that is outside the
363 // the set of trusted Gaia URLs. Sign in attempts that include visits to 363 // the set of trusted Gaia URLs. Sign in attempts that include visits to
364 // one more untrusted will cause a modal dialog to appear asking the user 364 // one more untrusted will cause a modal dialog to appear asking the user
365 // to confirm, similar to the interstitial flow. 365 // to confirm, similar to the interstitial flow.
(...skipping 11 matching lines...) Expand all
377 377
378 // Allows unittest to avoid starting sync for real. 378 // Allows unittest to avoid starting sync for real.
379 bool do_not_start_sync_for_testing_; 379 bool do_not_start_sync_for_testing_;
380 380
381 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; 381 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_;
382 382
383 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); 383 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper);
384 }; 384 };
385 385
386 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 386 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698