| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Callback callback); | 105 Callback callback); |
| 106 | 106 |
| 107 // chrome::BrowserListObserver override. | 107 // chrome::BrowserListObserver override. |
| 108 void OnBrowserRemoved(Browser* browser) override; | 108 void OnBrowserRemoved(Browser* browser) override; |
| 109 | 109 |
| 110 // If the |browser| argument is non-null, returns the pointer directly. | 110 // If the |browser| argument is non-null, returns the pointer directly. |
| 111 // Otherwise creates a new browser for the given profile on the given | 111 // Otherwise creates a new browser for the given profile on the given |
| 112 // desktop, adds an empty tab and makes sure the browser is visible. | 112 // desktop, adds an empty tab and makes sure the browser is visible. |
| 113 static Browser* EnsureBrowser(Browser* browser, | 113 static Browser* EnsureBrowser(Browser* browser, |
| 114 Profile* profile, | 114 Profile* profile, |
| 115 chrome::HostDesktopType desktop_type); | 115 ui::HostDesktopType desktop_type); |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 friend class OneClickSigninSyncStarterTest; | 118 friend class OneClickSigninSyncStarterTest; |
| 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackSigninFailed); | 119 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackSigninFailed); |
| 120 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackNull); | 120 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackNull); |
| 121 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, LoadContinueUrl); | 121 FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, LoadContinueUrl); |
| 122 | 122 |
| 123 ~OneClickSigninSyncStarter() override; | 123 ~OneClickSigninSyncStarter() override; |
| 124 | 124 |
| 125 // Initializes the internals of the OneClickSigninSyncStarter object. Can also | 125 // Initializes the internals of the OneClickSigninSyncStarter object. Can also |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Called to create a new profile, which is then signed in with the | 163 // Called to create a new profile, which is then signed in with the |
| 164 // in-progress auth credentials currently stored in this object. | 164 // in-progress auth credentials currently stored in this object. |
| 165 void CreateNewSignedInProfile(); | 165 void CreateNewSignedInProfile(); |
| 166 | 166 |
| 167 // Helper function that loads policy with the cached |dm_token_| and | 167 // Helper function that loads policy with the cached |dm_token_| and |
| 168 // |client_id|, then completes the signin process. | 168 // |client_id|, then completes the signin process. |
| 169 void LoadPolicyWithCachedCredentials(); | 169 void LoadPolicyWithCachedCredentials(); |
| 170 | 170 |
| 171 // Callback invoked once a profile is created, so we can complete the | 171 // Callback invoked once a profile is created, so we can complete the |
| 172 // credentials transfer, load policy, and open the first window. | 172 // credentials transfer, load policy, and open the first window. |
| 173 void CompleteInitForNewProfile(chrome::HostDesktopType desktop_type, | 173 void CompleteInitForNewProfile(ui::HostDesktopType desktop_type, |
| 174 Profile* profile, | 174 Profile* profile, |
| 175 Profile::CreateStatus status); | 175 Profile::CreateStatus status); |
| 176 | 176 |
| 177 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 177 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| 178 | 178 |
| 179 // Cancels the in-progress signin for this profile. | 179 // Cancels the in-progress signin for this profile. |
| 180 void CancelSigninAndDelete(); | 180 void CancelSigninAndDelete(); |
| 181 | 181 |
| 182 // Callback invoked to check whether the user needs policy or if a | 182 // Callback invoked to check whether the user needs policy or if a |
| 183 // confirmation is required (in which case we have to prompt the user first). | 183 // confirmation is required (in which case we have to prompt the user first). |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // the default "You are signed in" message is displayed. | 216 // the default "You are signed in" message is displayed. |
| 217 void DisplayFinalConfirmationBubble(const base::string16& custom_message); | 217 void DisplayFinalConfirmationBubble(const base::string16& custom_message); |
| 218 | 218 |
| 219 // Loads the |continue_url_| in the current tab. | 219 // Loads the |continue_url_| in the current tab. |
| 220 void LoadContinueUrl(); | 220 void LoadContinueUrl(); |
| 221 | 221 |
| 222 Profile* profile_; | 222 Profile* profile_; |
| 223 Browser* browser_; | 223 Browser* browser_; |
| 224 scoped_ptr<SigninTracker> signin_tracker_; | 224 scoped_ptr<SigninTracker> signin_tracker_; |
| 225 StartSyncMode start_mode_; | 225 StartSyncMode start_mode_; |
| 226 chrome::HostDesktopType desktop_type_; | 226 ui::HostDesktopType desktop_type_; |
| 227 ConfirmationRequired confirmation_required_; | 227 ConfirmationRequired confirmation_required_; |
| 228 GURL continue_url_; | 228 GURL continue_url_; |
| 229 | 229 |
| 230 // Callback executed when sync setup succeeds or fails. | 230 // Callback executed when sync setup succeeds or fails. |
| 231 Callback sync_setup_completed_callback_; | 231 Callback sync_setup_completed_callback_; |
| 232 | 232 |
| 233 #if defined(ENABLE_CONFIGURATION_POLICY) | 233 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 234 // Policy credentials we keep while determining whether to create | 234 // Policy credentials we keep while determining whether to create |
| 235 // a new profile for an enterprise user or not. | 235 // a new profile for an enterprise user or not. |
| 236 std::string dm_token_; | 236 std::string dm_token_; |
| 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 |