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

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

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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:
133 SyncStarterWrapper( 133 SyncStarterWrapper(
134 const OneClickSigninHelper::StartSyncArgs& args, 134 const OneClickSigninHelper::StartSyncArgs& args,
135 OneClickSigninSyncStarter::StartSyncMode start_mode); 135 OneClickSigninSyncStarter::StartSyncMode start_mode);
136 virtual ~SyncStarterWrapper(); 136 ~SyncStarterWrapper() override;
137 137
138 void Start(); 138 void Start();
139 139
140 private: 140 private:
141 void VerifyGaiaCookiesBeforeSignIn(); 141 void VerifyGaiaCookiesBeforeSignIn();
142 void OnGaiaCookiesFetched(const std::string session_index, 142 void OnGaiaCookiesFetched(const std::string session_index,
143 const net::CookieList& cookie_list); 143 const net::CookieList& cookie_list);
144 144
145 // Virtual to be overridden in tests. 145 // Virtual to be overridden in tests.
146 virtual void DisplayErrorBubble(const std::string& error_message); 146 virtual void DisplayErrorBubble(const std::string& error_message);
147 virtual void StartSigninOAuthHelper(); 147 virtual void StartSigninOAuthHelper();
148 virtual void StartOneClickSigninSyncStarter( 148 virtual void StartOneClickSigninSyncStarter(
149 const std::string& email, 149 const std::string& email,
150 const std::string& refresh_token); 150 const std::string& refresh_token);
151 151
152 // Overriden from SigninOAuthHelper::Consumer. 152 // Overriden from SigninOAuthHelper::Consumer.
153 virtual void OnSigninOAuthInformationAvailable( 153 void OnSigninOAuthInformationAvailable(
154 const std::string& email, 154 const std::string& email,
155 const std::string& display_email, 155 const std::string& display_email,
156 const std::string& refresh_token) override; 156 const std::string& refresh_token) override;
157 virtual void OnSigninOAuthInformationFailure( 157 void OnSigninOAuthInformationFailure(
158 const GoogleServiceAuthError& error) override; 158 const GoogleServiceAuthError& error) override;
159 159
160 // Overriden from chrome::BrowserListObserver. 160 // Overriden from chrome::BrowserListObserver.
161 virtual void OnBrowserRemoved(Browser* browser) override; 161 void OnBrowserRemoved(Browser* browser) override;
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
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 CanOfferOnIOThreadDisabledByPolicy); 278 CanOfferOnIOThreadDisabledByPolicy);
279 279
280 // Maximum number of navigations away from the set of valid Gaia URLs before 280 // Maximum number of navigations away from the set of valid Gaia URLs before
281 // clearing the internal state of the helper. This is necessary to support 281 // clearing the internal state of the helper. This is necessary to support
282 // SAML-based accounts, but causes bug crbug.com/181163. 282 // SAML-based accounts, but causes bug crbug.com/181163.
283 static const int kMaxNavigationsSince; 283 static const int kMaxNavigationsSince;
284 284
285 OneClickSigninHelper(content::WebContents* web_contents, 285 OneClickSigninHelper(content::WebContents* web_contents,
286 password_manager::PasswordManager* password_manager); 286 password_manager::PasswordManager* password_manager);
287 287
288 virtual ~OneClickSigninHelper(); 288 ~OneClickSigninHelper() override;
289 289
290 // Returns true if the one-click signin feature can be offered at this time. 290 // Returns true if the one-click signin feature can be offered at this time.
291 // It can be offered if the io_data is not in an incognito window and if the 291 // It can be offered if the io_data is not in an incognito window and if the
292 // origin of |url| is a valid Gaia sign in origin. This function is meant 292 // origin of |url| is a valid Gaia sign in origin. This function is meant
293 // to called only from the IO thread. 293 // to called only from the IO thread.
294 static Offer CanOfferOnIOThreadImpl(const GURL& url, 294 static Offer CanOfferOnIOThreadImpl(const GURL& url,
295 base::SupportsUserData* request, 295 base::SupportsUserData* request,
296 ProfileIOData* io_data); 296 ProfileIOData* io_data);
297 297
298 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread. 298 // The portion of ShowInfoBarIfPossible() that needs to run on the UI thread.
(...skipping 26 matching lines...) Expand all
325 // TestingProfile provides. 325 // TestingProfile provides.
326 void SetDoNotClearPendingEmailForTesting(); 326 void SetDoNotClearPendingEmailForTesting();
327 327
328 // In unit tests, disable starting the actual sync. 328 // In unit tests, disable starting the actual sync.
329 void set_do_not_start_sync_for_testing(); 329 void set_do_not_start_sync_for_testing();
330 330
331 // Called when password has been submitted. 331 // Called when password has been submitted.
332 void PasswordSubmitted(const autofill::PasswordForm& form); 332 void PasswordSubmitted(const autofill::PasswordForm& form);
333 333
334 // content::WebContentsObserver overrides. 334 // content::WebContentsObserver overrides.
335 virtual void DidStartNavigationToPendingEntry( 335 void DidStartNavigationToPendingEntry(
336 const GURL& url, 336 const GURL& url,
337 content::NavigationController::ReloadType reload_type) override; 337 content::NavigationController::ReloadType reload_type) override;
338 virtual void DidNavigateMainFrame( 338 void DidNavigateMainFrame(
339 const content::LoadCommittedDetails& details, 339 const content::LoadCommittedDetails& details,
340 const content::FrameNavigateParams& params) override; 340 const content::FrameNavigateParams& params) override;
341 virtual void DidStopLoading( 341 void DidStopLoading(content::RenderViewHost* render_view_host) override;
342 content::RenderViewHost* render_view_host) override;
343 342
344 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback(); 343 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback();
345 344
346 // Callback invoked when OneClickSigninSyncStarter completes sync setup. 345 // Callback invoked when OneClickSigninSyncStarter completes sync setup.
347 void SyncSetupCompletedCallback( 346 void SyncSetupCompletedCallback(
348 OneClickSigninSyncStarter::SyncSetupResult result); 347 OneClickSigninSyncStarter::SyncSetupResult result);
349 348
350 // Tracks if we are in the process of showing the signin or one click 349 // Tracks if we are in the process of showing the signin or one click
351 // interstitial page. It's set to true the first time we load one of those 350 // interstitial page. It's set to true the first time we load one of those
352 // pages and set to false when transient state is cleaned. 351 // pages and set to false when transient state is cleaned.
(...skipping 30 matching lines...) Expand all
383 382
384 // Allows unittest to avoid starting sync for real. 383 // Allows unittest to avoid starting sync for real.
385 bool do_not_start_sync_for_testing_; 384 bool do_not_start_sync_for_testing_;
386 385
387 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; 386 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_;
388 387
389 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); 388 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper);
390 }; 389 };
391 390
392 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ 391 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698