| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 class URLRequest; | 37 class URLRequest; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Per-tab one-click signin helper. When a user signs in to a Google service | 40 // Per-tab one-click signin helper. When a user signs in to a Google service |
| 41 // and the profile is not yet connected to a Google account, will start the | 41 // and the profile is not yet connected to a Google account, will start the |
| 42 // process of helping the user connect his profile with one click. The process | 42 // process of helping the user connect his profile with one click. The process |
| 43 // begins with an infobar and is followed with a confirmation dialog explaining | 43 // begins with an infobar and is followed with a confirmation dialog explaining |
| 44 // more about what this means. | 44 // more about what this means. |
| 45 class OneClickSigninHelper | 45 class OneClickSigninHelper |
| 46 : public content::WebContentsObserver, | 46 : public content::WebContentsObserver, |
| 47 public content::WebContentsUserData<OneClickSigninHelper>, | 47 public content::WebContentsUserData<OneClickSigninHelper> { |
| 48 public ProfileSyncServiceObserver { | |
| 49 public: | 48 public: |
| 50 // Represents user's decision about sign in process. | 49 // Represents user's decision about sign in process. |
| 51 enum AutoAccept { | 50 enum AutoAccept { |
| 52 // User decision not yet known. Assume cancel. | 51 // User decision not yet known. Assume cancel. |
| 53 AUTO_ACCEPT_NONE, | 52 AUTO_ACCEPT_NONE, |
| 54 | 53 |
| 55 // User has explicitly accepted to sign in. A bubble is shown with the | 54 // User has explicitly accepted to sign in. A bubble is shown with the |
| 56 // option to start sync, configure it first, or abort. | 55 // option to start sync, configure it first, or abort. |
| 57 AUTO_ACCEPT_ACCEPTED, | 56 AUTO_ACCEPT_ACCEPTED, |
| 58 | 57 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIncognitoTest, | 245 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIncognitoTest, |
| 247 ShowInfoBarUIThreadIncognito); | 246 ShowInfoBarUIThreadIncognito); |
| 248 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | 247 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, |
| 249 SigninFromWebstoreWithConfigSyncfirst); | 248 SigninFromWebstoreWithConfigSyncfirst); |
| 250 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | 249 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, |
| 251 ShowSigninBubbleAfterSigninComplete); | 250 ShowSigninBubbleAfterSigninComplete); |
| 252 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, SigninCancelled); | 251 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, SigninCancelled); |
| 253 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, SigninFailed); | 252 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, SigninFailed); |
| 254 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | 253 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, |
| 255 CleanTransientStateOnNavigate); | 254 CleanTransientStateOnNavigate); |
| 256 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperTest, | |
| 257 RemoveObserverFromProfileSyncService); | |
| 258 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); | 255 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, CanOfferOnIOThread); |
| 259 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 256 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 260 CanOfferOnIOThreadIncognito); | 257 CanOfferOnIOThreadIncognito); |
| 261 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 258 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 262 CanOfferOnIOThreadNoIOData); | 259 CanOfferOnIOThreadNoIOData); |
| 263 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 260 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 264 CanOfferOnIOThreadBadURL); | 261 CanOfferOnIOThreadBadURL); |
| 265 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 262 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| 266 CanOfferOnIOThreadDisabled); | 263 CanOfferOnIOThreadDisabled); |
| 267 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, | 264 FRIEND_TEST_ALL_PREFIXES(OneClickSigninHelperIOTest, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 332 |
| 336 // content::WebContentsObserver overrides. | 333 // content::WebContentsObserver overrides. |
| 337 virtual void DidStartNavigationToPendingEntry( | 334 virtual void DidStartNavigationToPendingEntry( |
| 338 const GURL& url, | 335 const GURL& url, |
| 339 content::NavigationController::ReloadType reload_type) OVERRIDE; | 336 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 340 virtual void DidNavigateMainFrame( | 337 virtual void DidNavigateMainFrame( |
| 341 const content::LoadCommittedDetails& details, | 338 const content::LoadCommittedDetails& details, |
| 342 const content::FrameNavigateParams& params) OVERRIDE; | 339 const content::FrameNavigateParams& params) OVERRIDE; |
| 343 virtual void DidStopLoading( | 340 virtual void DidStopLoading( |
| 344 content::RenderViewHost* render_view_host) OVERRIDE; | 341 content::RenderViewHost* render_view_host) OVERRIDE; |
| 345 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; | |
| 346 | |
| 347 // ProfileSyncServiceObserver. | |
| 348 virtual void OnStateChanged() OVERRIDE; | |
| 349 | 342 |
| 350 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback(); | 343 OneClickSigninSyncStarter::Callback CreateSyncStarterCallback(); |
| 351 | 344 |
| 352 // Callback invoked when OneClickSigninSyncStarter completes sync setup. | 345 // Callback invoked when OneClickSigninSyncStarter completes sync setup. |
| 353 void SyncSetupCompletedCallback( | 346 void SyncSetupCompletedCallback( |
| 354 OneClickSigninSyncStarter::SyncSetupResult result); | 347 OneClickSigninSyncStarter::SyncSetupResult result); |
| 355 | 348 |
| 356 // 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 |
| 357 // 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 |
| 358 // 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 Loading... |
| 389 | 382 |
| 390 // Allows unittest to avoid starting sync for real. | 383 // Allows unittest to avoid starting sync for real. |
| 391 bool do_not_start_sync_for_testing_; | 384 bool do_not_start_sync_for_testing_; |
| 392 | 385 |
| 393 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; | 386 base::WeakPtrFactory<OneClickSigninHelper> weak_pointer_factory_; |
| 394 | 387 |
| 395 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); | 388 DISALLOW_COPY_AND_ASSIGN(OneClickSigninHelper); |
| 396 }; | 389 }; |
| 397 | 390 |
| 398 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ | 391 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_HELPER_H_ |
| OLD | NEW |