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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.h

Issue 16092009: Make sure OneClickSigninSyncStarter detects Browser object being closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch before 2nd commit Created 7 years, 6 months 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
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_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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/signin_tracker.h" 12 #include "chrome/browser/signin/signin_tracker.h"
13 #include "chrome/browser/ui/browser_list_observer.h"
13 #include "chrome/browser/ui/host_desktop.h" 14 #include "chrome/browser/ui/host_desktop.h"
14 15
15 class Browser; 16 class Browser;
16 class ProfileSyncService; 17 class ProfileSyncService;
17 18
18 namespace policy { 19 namespace policy {
19 class CloudPolicyClient; 20 class CloudPolicyClient;
20 } 21 }
21 22
22 // Waits for successful singin notification from the signin manager and then 23 // Waits for successful singin notification from the signin manager and then
23 // starts the sync machine. Instances of this class delete themselves once 24 // starts the sync machine. Instances of this class delete themselves once
24 // the job is done. 25 // the job is done.
25 class OneClickSigninSyncStarter : public SigninTracker::Observer { 26 class OneClickSigninSyncStarter : public SigninTracker::Observer,
27 public chrome::BrowserListObserver {
26 public: 28 public:
27 enum StartSyncMode { 29 enum StartSyncMode {
28 // Starts the process of signing the user in with the SigninManager, and 30 // Starts the process of signing the user in with the SigninManager, and
29 // once completed automatically starts sync with all data types enabled. 31 // once completed automatically starts sync with all data types enabled.
30 SYNC_WITH_DEFAULT_SETTINGS, 32 SYNC_WITH_DEFAULT_SETTINGS,
31 33
32 // Starts the process of signing the user in with the SigninManager, and 34 // Starts the process of signing the user in with the SigninManager, and
33 // once completed redirects the user to the settings page to allow them 35 // once completed redirects the user to the settings page to allow them
34 // to configure which data types to sync before sync is enabled. 36 // to configure which data types to sync before sync is enabled.
35 CONFIGURE_SYNC_FIRST, 37 CONFIGURE_SYNC_FIRST,
(...skipping 21 matching lines...) Expand all
57 // signin before signin completes. 59 // signin before signin completes.
58 OneClickSigninSyncStarter(Profile* profile, 60 OneClickSigninSyncStarter(Profile* profile,
59 Browser* browser, 61 Browser* browser,
60 const std::string& session_index, 62 const std::string& session_index,
61 const std::string& email, 63 const std::string& email,
62 const std::string& password, 64 const std::string& password,
63 StartSyncMode start_mode, 65 StartSyncMode start_mode,
64 bool force_same_tab_navigation, 66 bool force_same_tab_navigation,
65 ConfirmationRequired display_confirmation); 67 ConfirmationRequired display_confirmation);
66 68
69 // chrome::BrowserListObserver override.
70 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
71
67 private: 72 private:
68 virtual ~OneClickSigninSyncStarter(); 73 virtual ~OneClickSigninSyncStarter();
69 74
70 // Initializes the internals of the OneClickSigninSyncStarter object. Can also 75 // Initializes the internals of the OneClickSigninSyncStarter object. Can also
71 // be used to re-initialize the object to refer to a newly created profile. 76 // be used to re-initialize the object to refer to a newly created profile.
72 void Initialize(Profile* profile, Browser* browser); 77 void Initialize(Profile* profile, Browser* browser);
73 78
74 // SigninTracker::Observer override. 79 // SigninTracker::Observer override.
75 virtual void GaiaCredentialsValid() OVERRIDE; 80 virtual void GaiaCredentialsValid() OVERRIDE;
76 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; 81 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // CloudPolicyClient reference we keep while determining whether to create 157 // CloudPolicyClient reference we keep while determining whether to create
153 // a new profile for an enterprise user or not. 158 // a new profile for an enterprise user or not.
154 scoped_ptr<policy::CloudPolicyClient> policy_client_; 159 scoped_ptr<policy::CloudPolicyClient> policy_client_;
155 #endif 160 #endif
156 161
157 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); 162 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter);
158 }; 163 };
159 164
160 165
161 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ 166 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698