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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.h

Issue 11418200: Setup from settings should allow configuration first (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 8 years 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 | Annotate | Revision Log
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_WEBUI_SYNC_SETUP_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/signin/signin_tracker.h" 11 #include "chrome/browser/signin/signin_tracker.h"
12 #include "chrome/browser/ui/webui/options/options_ui.h" 12 #include "chrome/browser/ui/webui/options/options_ui.h"
13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
14 #include "content/public/browser/web_contents_observer.h"
14 15
15 class LoginUIService; 16 class LoginUIService;
16 class ProfileManager; 17 class ProfileManager;
17 class ProfileSyncService; 18 class ProfileSyncService;
18 class SigninManager; 19 class SigninManager;
19 20
21 namespace content {
22 class WebContents;
23 }
24
20 class SyncSetupHandler : public options::OptionsPageUIHandler, 25 class SyncSetupHandler : public options::OptionsPageUIHandler,
21 public SigninTracker::Observer, 26 public SigninTracker::Observer,
22 public LoginUIService::LoginUI { 27 public LoginUIService::LoginUI,
28 public content::WebContentsObserver {
23 public: 29 public:
24 // Constructs a new SyncSetupHandler. |profile_manager| may be NULL. 30 // Constructs a new SyncSetupHandler. |profile_manager| may be NULL.
25 explicit SyncSetupHandler(ProfileManager* profile_manager); 31 explicit SyncSetupHandler(ProfileManager* profile_manager);
26 virtual ~SyncSetupHandler(); 32 virtual ~SyncSetupHandler();
27 33
28 // OptionsPageUIHandler implementation. 34 // OptionsPageUIHandler implementation.
29 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings) 35 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings)
30 OVERRIDE; 36 OVERRIDE;
31 virtual void RegisterMessages() OVERRIDE; 37 virtual void RegisterMessages() OVERRIDE;
32 38
33 // SigninTracker::Observer implementation. 39 // SigninTracker::Observer implementation.
34 virtual void GaiaCredentialsValid() OVERRIDE; 40 virtual void GaiaCredentialsValid() OVERRIDE;
35 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; 41 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
36 virtual void SigninSuccess() OVERRIDE; 42 virtual void SigninSuccess() OVERRIDE;
37 43
38 // LoginUIService::LoginUI implementation. 44 // LoginUIService::LoginUI implementation.
39 virtual void FocusUI() OVERRIDE; 45 virtual void FocusUI() OVERRIDE;
40 virtual void CloseUI() OVERRIDE; 46 virtual void CloseUI() OVERRIDE;
41 47
48 // content::WebContentsObserver implementation.
49 virtual void WebContentsDestroyed(
50 content::WebContents* web_contents) OVERRIDE;
51
42 static void GetStaticLocalizedValues( 52 static void GetStaticLocalizedValues(
43 base::DictionaryValue* localized_strings, 53 base::DictionaryValue* localized_strings,
44 content::WebUI* web_ui); 54 content::WebUI* web_ui);
45 55
46 // Initializes the sync setup flow and shows the setup UI. If |force_login| is 56 // Initializes the sync setup flow and shows the setup UI. If |force_login| is
47 // true, then the user is forced through the login flow even if they are 57 // true, then the user is forced through the login flow even if they are
48 // already signed in (useful for when it is necessary to force the user to 58 // already signed in (useful for when it is necessary to force the user to
49 // re-enter credentials so new tokens can be fetched). 59 // re-enter credentials so new tokens can be fetched).
50 void OpenSyncSetup(bool force_login); 60 void OpenSyncSetup(bool force_login);
51 61
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const std::string& password, 167 const std::string& password,
158 const std::string& captcha, 168 const std::string& captcha,
159 const std::string& access_code); 169 const std::string& access_code);
160 170
161 // If a wizard already exists, focus it and return true. 171 // If a wizard already exists, focus it and return true.
162 bool FocusExistingWizardIfPresent(); 172 bool FocusExistingWizardIfPresent();
163 173
164 // Invokes the javascript call to close the setup overlay. 174 // Invokes the javascript call to close the setup overlay.
165 void CloseOverlay(); 175 void CloseOverlay();
166 176
177 // When using web-flow, closes the Gaia page used to collection user
178 // credentials.
179 void CloseGaiaSigninPage();
180
167 // Returns true if the given login data is valid, false otherwise. If the 181 // Returns true if the given login data is valid, false otherwise. If the
168 // login data is not valid then on return |error_message| will be set to a 182 // login data is not valid then on return |error_message| will be set to a
169 // localized error message. Note, |error_message| must not be NULL. 183 // localized error message. Note, |error_message| must not be NULL.
170 bool IsLoginAuthDataValid(const std::string& username, 184 bool IsLoginAuthDataValid(const std::string& username,
171 string16* error_message); 185 string16* error_message);
172 186
173 // Returns the SigninManager for the parent profile. 187 // Returns the SigninManager for the parent profile.
174 SigninManager* GetSignin() const; 188 SigninManager* GetSignin() const;
175 189
176 // The SigninTracker object used to determine when the user has fully signed 190 // The SigninTracker object used to determine when the user has fully signed
(...skipping 17 matching lines...) Expand all
194 GoogleServiceAuthError last_signin_error_; 208 GoogleServiceAuthError last_signin_error_;
195 209
196 // When setup starts with login UI, retry login if signing in failed. 210 // When setup starts with login UI, retry login if signing in failed.
197 // When setup starts without login UI, do not retry login and fail. 211 // When setup starts without login UI, do not retry login and fail.
198 bool retry_on_signin_failure_; 212 bool retry_on_signin_failure_;
199 213
200 // The OneShotTimer object used to timeout of starting the sync backend 214 // The OneShotTimer object used to timeout of starting the sync backend
201 // service. 215 // service.
202 scoped_ptr<base::OneShotTimer<SyncSetupHandler> > backend_start_timer_; 216 scoped_ptr<base::OneShotTimer<SyncSetupHandler> > backend_start_timer_;
203 217
218 // When using web-flow, pointer to the tab that holds the Gaia sign in page.
James Hawkins 2012/12/04 00:14:48 nit: 'weak pointer' I imagine.
Roger Tawa OOO till Jul 10th 2012/12/04 00:36:37 Done.
219 content::WebContents* active_gaia_signin_tab_;
220
204 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); 221 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler);
205 }; 222 };
206 223
207 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ 224 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698