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

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

Issue 11494003: Enable "Let me choose what to sync" checkbox in gaia sign in page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only redirect to NTP on error if explicit signin Created 8 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 | 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 #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 17 matching lines...) Expand all
28 // Per-tab one-click signin helper. When a user signs in to a Google service 28 // Per-tab one-click signin helper. When a user signs in to a Google service
29 // and the profile is not yet connected to a Google account, will start the 29 // and the profile is not yet connected to a Google account, will start the
30 // process of helping the user connect his profile with one click. The process 30 // process of helping the user connect his profile with one click. The process
31 // begins with an infobar and is followed with a confirmation dialog explaining 31 // begins with an infobar and is followed with a confirmation dialog explaining
32 // more about what this means. 32 // more about what this means.
33 class OneClickSigninHelper 33 class OneClickSigninHelper
34 : public content::WebContentsObserver, 34 : public content::WebContentsObserver,
35 public content::WebContentsUserData<OneClickSigninHelper>, 35 public content::WebContentsUserData<OneClickSigninHelper>,
36 public SigninTracker::Observer { 36 public SigninTracker::Observer {
37 public: 37 public:
38 // Represents user's decision about sign in process.
38 enum AutoAccept { 39 enum AutoAccept {
39 AUTO_ACCEPT, 40 // User decision not yet known. Assume cancel.
40 NO_AUTO_ACCEPT, 41 AUTO_ACCEPT_NONE,
42
43 // User has explicitly accepted to sign in. A bubble is shown with the
44 // option to start sync, configure it first, or abort.
45 AUTO_ACCEPT_ACCEPTED,
46
47 // User has explicitly accepted to sign in, but wants to configure sync
48 // settings before turing it on.
41 AUTO_ACCEPT_CONFIGURE, 49 AUTO_ACCEPT_CONFIGURE,
42 REJECTED_FOR_PROFILE, 50
51 // User has explicitly rejected to sign in. Furthermore, the user does
52 // not want to be prompted to see the interstitial again in this profile.
53 AUTO_ACCEPT_REJECTED_FOR_PROFILE,
54
55 // This is an explicit sign in from either first run, NTP, wrench menu,
56 // or settings page. The user will be signed in automatically with sync
57 // enabled using default settings.
43 AUTO_ACCEPT_EXPLICIT 58 AUTO_ACCEPT_EXPLICIT
44 }; 59 };
45 60
46 // Return value of CanOfferOnIOThread(). 61 // Return value of CanOfferOnIOThread().
47 enum Offer { 62 enum Offer {
48 CAN_OFFER, 63 CAN_OFFER,
49 DONT_OFFER, 64 DONT_OFFER,
50 IGNORE_REQUEST 65 IGNORE_REQUEST
51 }; 66 };
52 67
53 // Argument to CanOffer(). 68 // Argument to CanOffer().
54 enum CanOfferFor { 69 enum CanOfferFor {
55 CAN_OFFER_FOR_ALL, 70 CAN_OFFER_FOR_ALL,
56 CAN_OFFER_FOR_INTERSTITAL_ONLY, 71 CAN_OFFER_FOR_INTERSTITAL_ONLY
tim (not reviewing) 2012/12/14 19:48:29 Did you intend to get rid of this comma?
Roger Tawa OOO till Jul 10th 2012/12/16 03:03:46 yes.
57 }; 72 };
58 73
59 virtual ~OneClickSigninHelper(); 74 virtual ~OneClickSigninHelper();
60 75
61 // Called only by tests to associate information with a given request. 76 // Called only by tests to associate information with a given request.
62 static void AssociateWithRequestForTesting(base::SupportsUserData* request, 77 static void AssociateWithRequestForTesting(base::SupportsUserData* request,
63 const std::string& email); 78 const std::string& email);
64 79
65 // Returns true if the one-click signin feature can be offered at this time. 80 // Returns true if the one-click signin feature can be offered at this time.
66 // If |email| is not empty, then the profile is checked to see if it's 81 // If |email| is not empty, then the profile is checked to see if it's
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 144
130 // Returns true if the one-click signin feature can be offered at this time. 145 // Returns true if the one-click signin feature can be offered at this time.
131 // It can be offered if the io_data is not in an incognito window and if the 146 // It can be offered if the io_data is not in an incognito window and if the
132 // origin of |url| is a valid Gaia sign in origin. This function is meant 147 // origin of |url| is a valid Gaia sign in origin. This function is meant
133 // to called only from the IO thread. 148 // to called only from the IO thread.
134 static Offer CanOfferOnIOThreadImpl(const GURL& url, 149 static Offer CanOfferOnIOThreadImpl(const GURL& url,
135 const std::string& referrer, 150 const std::string& referrer,
136 base::SupportsUserData* request, 151 base::SupportsUserData* request,
137 ProfileIOData* io_data); 152 ProfileIOData* io_data);
138 153
139 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. 154 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread.
tim (not reviewing) 2012/12/14 19:48:29 Can you explain the parameters? As in, a high lev
Roger Tawa OOO till Jul 10th 2012/12/16 03:03:46 Done.
140 static void ShowInfoBarUIThread(const std::string& session_index, 155 static void ShowInfoBarUIThread(const std::string& session_index,
141 const std::string& email, 156 const std::string& email,
142 AutoAccept auto_accept, 157 AutoAccept auto_accept,
143 SyncPromoUI::Source source, 158 SyncPromoUI::Source source,
159 const GURL& continue_url,
144 int child_id, 160 int child_id,
145 int route_id); 161 int route_id);
146 162
147 void RedirectToNTP(); 163 void RedirectToNTP();
148 164
149 // Clear all data member of the helper, except for the error. 165 // Clear all data member of the helper, except for the error.
150 void CleanTransientState(); 166 void CleanTransientState();
151 167
152 // content::WebContentsObserver overrides. 168 // content::WebContentsObserver overrides.
153 virtual void DidNavigateAnyFrame( 169 virtual void DidNavigateAnyFrame(
154 const content::LoadCommittedDetails& details, 170 const content::LoadCommittedDetails& details,
155 const content::FrameNavigateParams& params) OVERRIDE; 171 const content::FrameNavigateParams& params) OVERRIDE;
156 virtual void DidStopLoading( 172 virtual void DidStopLoading(
157 content::RenderViewHost* render_view_host) OVERRIDE; 173 content::RenderViewHost* render_view_host) OVERRIDE;
158 174
159 // SigninTracker::Observer override. 175 // SigninTracker::Observer override.
160 virtual void GaiaCredentialsValid() OVERRIDE; 176 virtual void GaiaCredentialsValid() OVERRIDE;
161 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; 177 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
162 virtual void SigninSuccess() OVERRIDE; 178 virtual void SigninSuccess() OVERRIDE;
163 179
164 // Information about the account that has just logged in. 180 // Information about the account that has just logged in.
165 std::string session_index_; 181 std::string session_index_;
166 std::string email_; 182 std::string email_;
167 std::string password_; 183 std::string password_;
168 AutoAccept auto_accept_; 184 AutoAccept auto_accept_;
169 SyncPromoUI::Source source_; 185 SyncPromoUI::Source source_;
186 GURL continue_url_;
170 std::string error_message_; 187 std::string error_message_;
171 188
172 scoped_ptr<SigninTracker> signin_tracker_; 189 scoped_ptr<SigninTracker> signin_tracker_;
173 190
174 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); 191 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper);
175 }; 192 };
176 193
177 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 194 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698