| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 typedef base::Callback<void(SyncSetupResult)> Callback; | 73 typedef base::Callback<void(SyncSetupResult)> Callback; |
| 74 | 74 |
| 75 // |profile| must not be NULL, however |browser| can be. When using the | 75 // |profile| must not be NULL, however |browser| can be. When using the |
| 76 // OneClickSigninSyncStarter from a browser, provide both. | 76 // OneClickSigninSyncStarter from a browser, provide both. |
| 77 // If |display_confirmation| is true, the user will be prompted to confirm the | 77 // If |display_confirmation| is true, the user will be prompted to confirm the |
| 78 // signin before signin completes. | 78 // signin before signin completes. |
| 79 // |web_contents| is used to show the sync UI if it's showing a blank page | 79 // |web_contents| is used to show the sync UI if it's showing a blank page |
| 80 // and not about to be closed. It can be NULL. | 80 // and not about to be closed. It can be NULL. |
| 81 // If |web_contents| is non-NULL and the |continue_url| is non-empty, the |
| 82 // |web_contents| will be navigated to the |continue_url| once both signin and |
| 83 // Sync setup are complete. |
| 81 // |callback| is always executed before OneClickSigninSyncStarter is deleted. | 84 // |callback| is always executed before OneClickSigninSyncStarter is deleted. |
| 82 // It can be empty. | 85 // It can be empty. |
| 83 OneClickSigninSyncStarter(Profile* profile, | 86 OneClickSigninSyncStarter(Profile* profile, |
| 84 Browser* browser, | 87 Browser* browser, |
| 85 const std::string& email, | 88 const std::string& email, |
| 86 const std::string& password, | 89 const std::string& password, |
| 87 const std::string& refresh_token, | 90 const std::string& refresh_token, |
| 88 StartSyncMode start_mode, | 91 StartSyncMode start_mode, |
| 89 content::WebContents* web_contents, | 92 content::WebContents* web_contents, |
| 90 ConfirmationRequired display_confirmation, | 93 ConfirmationRequired display_confirmation, |
| 94 const GURL& continue_url, |
| 91 Callback callback); | 95 Callback callback); |
| 92 | 96 |
| 93 // chrome::BrowserListObserver override. | 97 // chrome::BrowserListObserver override. |
| 94 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 98 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
| 95 | 99 |
| 96 // If the |browser| argument is non-null, returns the pointer directly. | 100 // If the |browser| argument is non-null, returns the pointer directly. |
| 97 // Otherwise creates a new browser for the given profile on the given | 101 // Otherwise creates a new browser for the given profile on the given |
| 98 // desktop, adds an empty tab and makes sure the browser is visible. | 102 // desktop, adds an empty tab and makes sure the browser is visible. |
| 99 static Browser* EnsureBrowser(Browser* browser, | 103 static Browser* EnsureBrowser(Browser* browser, |
| 100 Profile* profile, | 104 Profile* profile, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 199 |
| 196 // Displays a settings page in the provided web contents. |sub_page| can be | 200 // Displays a settings page in the provided web contents. |sub_page| can be |
| 197 // empty to show the main settings page. | 201 // empty to show the main settings page. |
| 198 void ShowSettingsPageInWebContents(content::WebContents* contents, | 202 void ShowSettingsPageInWebContents(content::WebContents* contents, |
| 199 const std::string& sub_page); | 203 const std::string& sub_page); |
| 200 | 204 |
| 201 // Shows the post-signin confirmation bubble. If |custom_message| is empty, | 205 // Shows the post-signin confirmation bubble. If |custom_message| is empty, |
| 202 // the default "You are signed in" message is displayed. | 206 // the default "You are signed in" message is displayed. |
| 203 void DisplayFinalConfirmationBubble(const base::string16& custom_message); | 207 void DisplayFinalConfirmationBubble(const base::string16& custom_message); |
| 204 | 208 |
| 209 // Loads the |continue_url_| in the current tab. |
| 210 void LoadContinueUrl(); |
| 211 |
| 205 Profile* profile_; | 212 Profile* profile_; |
| 206 Browser* browser_; | 213 Browser* browser_; |
| 207 scoped_ptr<SigninTracker> signin_tracker_; | 214 scoped_ptr<SigninTracker> signin_tracker_; |
| 208 StartSyncMode start_mode_; | 215 StartSyncMode start_mode_; |
| 209 chrome::HostDesktopType desktop_type_; | 216 chrome::HostDesktopType desktop_type_; |
| 210 bool force_same_tab_navigation_; | 217 bool force_same_tab_navigation_; |
| 211 ConfirmationRequired confirmation_required_; | 218 ConfirmationRequired confirmation_required_; |
| 219 GURL continue_url_; |
| 212 | 220 |
| 213 // Callback executed when sync setup succeeds or fails. | 221 // Callback executed when sync setup succeeds or fails. |
| 214 Callback sync_setup_completed_callback_; | 222 Callback sync_setup_completed_callback_; |
| 215 | 223 |
| 216 #if defined(ENABLE_CONFIGURATION_POLICY) | 224 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 217 // Policy credentials we keep while determining whether to create | 225 // Policy credentials we keep while determining whether to create |
| 218 // a new profile for an enterprise user or not. | 226 // a new profile for an enterprise user or not. |
| 219 std::string dm_token_; | 227 std::string dm_token_; |
| 220 std::string client_id_; | 228 std::string client_id_; |
| 221 #endif | 229 #endif |
| 222 | 230 |
| 223 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; | 231 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; |
| 224 | 232 |
| 225 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 233 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
| 226 }; | 234 }; |
| 227 | 235 |
| 228 | 236 |
| 229 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 237 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
| OLD | NEW |