| 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_SYNC_STARTER_H_ | 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
| 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const std::string& email, | 97 const std::string& email, |
| 98 const std::string& password, | 98 const std::string& password, |
| 99 const std::string& refresh_token, | 99 const std::string& refresh_token, |
| 100 StartSyncMode start_mode, | 100 StartSyncMode start_mode, |
| 101 content::WebContents* web_contents, | 101 content::WebContents* web_contents, |
| 102 ConfirmationRequired display_confirmation, | 102 ConfirmationRequired display_confirmation, |
| 103 const GURL& continue_url, | 103 const GURL& continue_url, |
| 104 Callback callback); | 104 Callback callback); |
| 105 | 105 |
| 106 // chrome::BrowserListObserver override. | 106 // chrome::BrowserListObserver override. |
| 107 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 107 virtual void OnBrowserRemoved(Browser* browser) override; |
| 108 | 108 |
| 109 // If the |browser| argument is non-null, returns the pointer directly. | 109 // If the |browser| argument is non-null, returns the pointer directly. |
| 110 // Otherwise creates a new browser for the given profile on the given | 110 // Otherwise creates a new browser for the given profile on the given |
| 111 // desktop, adds an empty tab and makes sure the browser is visible. | 111 // desktop, adds an empty tab and makes sure the browser is visible. |
| 112 static Browser* EnsureBrowser(Browser* browser, | 112 static Browser* EnsureBrowser(Browser* browser, |
| 113 Profile* profile, | 113 Profile* profile, |
| 114 chrome::HostDesktopType desktop_type); | 114 chrome::HostDesktopType desktop_type); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 friend class OneClickSigninSyncStarterTest; | 117 friend class OneClickSigninSyncStarterTest; |
| 118 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackSigninFailed); | 118 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackSigninFailed); |
| 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackNull); | 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackNull); |
| 120 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, LoadContinueUrl); | 120 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, LoadContinueUrl); |
| 121 | 121 |
| 122 virtual ~OneClickSigninSyncStarter(); | 122 virtual ~OneClickSigninSyncStarter(); |
| 123 | 123 |
| 124 // Initializes the internals of the OneClickSigninSyncStarter object. Can also | 124 // Initializes the internals of the OneClickSigninSyncStarter object. Can also |
| 125 // be used to re-initialize the object to refer to a newly created profile. | 125 // be used to re-initialize the object to refer to a newly created profile. |
| 126 void Initialize(Profile* profile, Browser* browser); | 126 void Initialize(Profile* profile, Browser* browser); |
| 127 | 127 |
| 128 // SigninTracker::Observer override. | 128 // SigninTracker::Observer override. |
| 129 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | 129 virtual void SigninFailed(const GoogleServiceAuthError& error) override; |
| 130 virtual void SigninSuccess() OVERRIDE; | 130 virtual void SigninSuccess() override; |
| 131 virtual void MergeSessionComplete( | 131 virtual void MergeSessionComplete( |
| 132 const GoogleServiceAuthError& error) OVERRIDE; | 132 const GoogleServiceAuthError& error) override; |
| 133 | 133 |
| 134 // LoginUIService::Observer override. | 134 // LoginUIService::Observer override. |
| 135 virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) OVERRIDE; | 135 virtual void OnSyncConfirmationUIClosed(bool configure_sync_first) override; |
| 136 | 136 |
| 137 #if defined(ENABLE_CONFIGURATION_POLICY) | 137 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 138 // User input handler for the signin confirmation dialog. | 138 // User input handler for the signin confirmation dialog. |
| 139 class SigninDialogDelegate | 139 class SigninDialogDelegate |
| 140 : public ui::ProfileSigninConfirmationDelegate { | 140 : public ui::ProfileSigninConfirmationDelegate { |
| 141 public: | 141 public: |
| 142 SigninDialogDelegate( | 142 SigninDialogDelegate( |
| 143 base::WeakPtr<OneClickSigninSyncStarter> sync_starter); | 143 base::WeakPtr<OneClickSigninSyncStarter> sync_starter); |
| 144 virtual ~SigninDialogDelegate(); | 144 virtual ~SigninDialogDelegate(); |
| 145 virtual void OnCancelSignin() OVERRIDE; | 145 virtual void OnCancelSignin() override; |
| 146 virtual void OnContinueSignin() OVERRIDE; | 146 virtual void OnContinueSignin() override; |
| 147 virtual void OnSigninWithNewProfile() OVERRIDE; | 147 virtual void OnSigninWithNewProfile() override; |
| 148 private: | 148 private: |
| 149 base::WeakPtr<OneClickSigninSyncStarter> sync_starter_; | 149 base::WeakPtr<OneClickSigninSyncStarter> sync_starter_; |
| 150 }; | 150 }; |
| 151 friend class SigninDialogDelegate; | 151 friend class SigninDialogDelegate; |
| 152 | 152 |
| 153 // Callback invoked once policy registration is complete. If registration | 153 // Callback invoked once policy registration is complete. If registration |
| 154 // fails, |dm_token| and |client_id| will be empty. | 154 // fails, |dm_token| and |client_id| will be empty. |
| 155 void OnRegisteredForPolicy(const std::string& dm_token, | 155 void OnRegisteredForPolicy(const std::string& dm_token, |
| 156 const std::string& client_id); | 156 const std::string& client_id); |
| 157 | 157 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 std::string client_id_; | 237 std::string client_id_; |
| 238 #endif | 238 #endif |
| 239 | 239 |
| 240 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; | 240 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; |
| 241 | 241 |
| 242 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 242 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 | 245 |
| 246 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 246 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
| OLD | NEW |