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

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

Issue 19705013: [password autofill] Remove references to PasswordForm from RenderViewImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 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 | 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"
11 #include "chrome/browser/password_manager/password_manager.h"
11 #include "chrome/browser/sync/profile_sync_service_observer.h" 12 #include "chrome/browser/sync/profile_sync_service_observer.h"
12 #include "chrome/browser/ui/sync/sync_promo_ui.h" 13 #include "chrome/browser/ui/sync/sync_promo_ui.h"
13 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/browser/web_contents_user_data.h" 16 #include "content/public/browser/web_contents_user_data.h"
16 #include "google_apis/gaia/google_service_auth_error.h" 17 #include "google_apis/gaia/google_service_auth_error.h"
17 18
18 class Browser; 19 class Browser;
19 class GURL; 20 class GURL;
20 class ProfileIOData; 21 class ProfileIOData;
(...skipping 10 matching lines...) Expand all
31 } 32 }
32 33
33 // Per-tab one-click signin helper. When a user signs in to a Google service 34 // Per-tab one-click signin helper. When a user signs in to a Google service
34 // and the profile is not yet connected to a Google account, will start the 35 // and the profile is not yet connected to a Google account, will start the
35 // process of helping the user connect his profile with one click. The process 36 // process of helping the user connect his profile with one click. The process
36 // begins with an infobar and is followed with a confirmation dialog explaining 37 // begins with an infobar and is followed with a confirmation dialog explaining
37 // more about what this means. 38 // more about what this means.
38 class OneClickSigninHelper 39 class OneClickSigninHelper
39 : public content::WebContentsObserver, 40 : public content::WebContentsObserver,
40 public content::WebContentsUserData<OneClickSigninHelper>, 41 public content::WebContentsUserData<OneClickSigninHelper>,
42 public PasswordManager::SubmissionObserver,
41 public ProfileSyncServiceObserver { 43 public ProfileSyncServiceObserver {
42 public: 44 public:
43 // Represents user's decision about sign in process. 45 // Represents user's decision about sign in process.
44 enum AutoAccept { 46 enum AutoAccept {
45 // User decision not yet known. Assume cancel. 47 // User decision not yet known. Assume cancel.
46 AUTO_ACCEPT_NONE, 48 AUTO_ACCEPT_NONE,
47 49
48 // User has explicitly accepted to sign in. A bubble is shown with the 50 // User has explicitly accepted to sign in. A bubble is shown with the
49 // option to start sync, configure it first, or abort. 51 // option to start sync, configure it first, or abort.
50 AUTO_ACCEPT_ACCEPTED, 52 AUTO_ACCEPT_ACCEPTED,
(...skipping 18 matching lines...) Expand all
69 DONT_OFFER, 71 DONT_OFFER,
70 IGNORE_REQUEST 72 IGNORE_REQUEST
71 }; 73 };
72 74
73 // Argument to CanOffer(). 75 // Argument to CanOffer().
74 enum CanOfferFor { 76 enum CanOfferFor {
75 CAN_OFFER_FOR_ALL, 77 CAN_OFFER_FOR_ALL,
76 CAN_OFFER_FOR_INTERSTITAL_ONLY 78 CAN_OFFER_FOR_INTERSTITAL_ONLY
77 }; 79 };
78 80
81 static void CreateForWebContentsWithPasswordManager(
82 content::WebContents* contents,
83 PasswordManager* password_manager);
84
79 virtual ~OneClickSigninHelper(); 85 virtual ~OneClickSigninHelper();
80 86
81 // Returns true if the one-click signin feature can be offered at this time. 87 // Returns true if the one-click signin feature can be offered at this time.
82 // If |email| is not empty, then the profile is checked to see if it's 88 // If |email| is not empty, then the profile is checked to see if it's
83 // already connected to a google account or if the user has already rejected 89 // already connected to a google account or if the user has already rejected
84 // one-click sign-in with this email, in which cases a one click signin 90 // one-click sign-in with this email, in which cases a one click signin
85 // should not be offered. 91 // should not be offered.
86 // 92 //
87 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the 93 // If |can_offer_for| is |CAN_OFFER_FOR_INTERSTITAL_ONLY|, then only do the
88 // checks that would affect the interstitial page. Otherwise, do the checks 94 // checks that would affect the interstitial page. Otherwise, do the checks
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, 161 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest,
156 CanOfferOnIOThreadNoSigninCookies); 162 CanOfferOnIOThreadNoSigninCookies);
157 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, 163 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest,
158 CanOfferOnIOThreadDisabledByPolicy); 164 CanOfferOnIOThreadDisabledByPolicy);
159 165
160 // Maximum number of navigations away from the set of valid Gaia URLs before 166 // Maximum number of navigations away from the set of valid Gaia URLs before
161 // clearing the internal state of the helper. This is necessary to support 167 // clearing the internal state of the helper. This is necessary to support
162 // SAML-based accounts, but causes bug crbug.com/181163. 168 // SAML-based accounts, but causes bug crbug.com/181163.
163 static const int kMaxNavigationsSince; 169 static const int kMaxNavigationsSince;
164 170
165 explicit OneClickSigninHelper(content::WebContents* web_contents); 171 OneClickSigninHelper(content::WebContents* web_contents,
172 PasswordManager* password_manager);
166 173
167 // 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.
168 // It can be offered if the io_data is not in an incognito window and if the 175 // It can be offered if the io_data is not in an incognito window and if the
169 // origin of |url| is a valid Gaia sign in origin. This function is meant 176 // origin of |url| is a valid Gaia sign in origin. This function is meant
170 // to called only from the IO thread. 177 // to called only from the IO thread.
171 static Offer CanOfferOnIOThreadImpl(const GURL& url, 178 static Offer CanOfferOnIOThreadImpl(const GURL& url,
172 const std::string& referrer, 179 const std::string& referrer,
173 base::SupportsUserData* request, 180 base::SupportsUserData* request,
174 ProfileIOData* io_data); 181 ProfileIOData* io_data);
175 182
(...skipping 21 matching lines...) Expand all
197 204
198 // Clear all data member of the helper, except for the error. 205 // Clear all data member of the helper, except for the error.
199 void CleanTransientState(); 206 void CleanTransientState();
200 207
201 // Unitests that use a TestingProfile should call this. 208 // Unitests that use a TestingProfile should call this.
202 // Otherwise, clearing the pending e-mail crashes because the code expects 209 // Otherwise, clearing the pending e-mail crashes because the code expects
203 // a real ResourceContext rather than the MockResourceContext a 210 // a real ResourceContext rather than the MockResourceContext a
204 // TestingProfile provides. 211 // TestingProfile provides.
205 void SetDoNotClearPendingEmailForTesting(); 212 void SetDoNotClearPendingEmailForTesting();
206 213
207 // Grab Gaia password if available. 214 // PasswordManager::SubmissionObserver
208 bool OnFormSubmitted(const content::PasswordForm& form); 215 virtual void PasswordSubmitted(const content::PasswordForm& form) OVERRIDE;
209 216
210 // content::WebContentsObserver overrides. 217 // content::WebContentsObserver overrides.
211 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
212 virtual void NavigateToPendingEntry( 218 virtual void NavigateToPendingEntry(
213 const GURL& url, 219 const GURL& url,
214 content::NavigationController::ReloadType reload_type) OVERRIDE; 220 content::NavigationController::ReloadType reload_type) OVERRIDE;
215 virtual void DidNavigateMainFrame( 221 virtual void DidNavigateMainFrame(
216 const content::LoadCommittedDetails& details, 222 const content::LoadCommittedDetails& details,
217 const content::FrameNavigateParams& params) OVERRIDE; 223 const content::FrameNavigateParams& params) OVERRIDE;
218 virtual void DidStopLoading( 224 virtual void DidStopLoading(
219 content::RenderViewHost* render_view_host) OVERRIDE; 225 content::RenderViewHost* render_view_host) OVERRIDE;
220 226
221 // ProfileSyncServiceObserver. 227 // ProfileSyncServiceObserver.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 bool untrusted_confirmation_required_; 260 bool untrusted_confirmation_required_;
255 261
256 // Allows unittests to avoid accessing the ResourceContext for clearing a 262 // Allows unittests to avoid accessing the ResourceContext for clearing a
257 // pending e-mail. 263 // pending e-mail.
258 bool do_not_clear_pending_email_; 264 bool do_not_clear_pending_email_;
259 265
260 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); 266 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper);
261 }; 267 };
262 268
263 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 269 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698