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

Side by Side Diff: chrome/browser/sync/startup_controller.h

Issue 195873020: [Sync] Move SyncPrefs into sync_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rerererebase Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SYNC_STARTUP_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_SYNC_STARTUP_CONTROLLER_H_
6 #define CHROME_BROWSER_SYNC_STARTUP_CONTROLLER_H_ 6 #define CHROME_BROWSER_SYNC_STARTUP_CONTROLLER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "sync/internal_api/public/base/model_type.h" 11 #include "sync/internal_api/public/base/model_type.h"
12 12
13 class ManagedUserSigninManagerWrapper; 13 class ManagedUserSigninManagerWrapper;
14 class ProfileOAuth2TokenService; 14 class ProfileOAuth2TokenService;
15 15
16 namespace sync_driver {
17 class SyncPrefs;
18 }
19
16 namespace browser_sync { 20 namespace browser_sync {
17 21
18 class SyncPrefs;
19
20 // Defines the type of behavior the sync engine should use. If configured for 22 // Defines the type of behavior the sync engine should use. If configured for
21 // AUTO_START, the sync engine will automatically call SetSyncSetupCompleted() 23 // AUTO_START, the sync engine will automatically call SetSyncSetupCompleted()
22 // and start downloading data types as soon as sync credentials are available. 24 // and start downloading data types as soon as sync credentials are available.
23 // If configured for MANUAL_START, sync will not start until the user 25 // If configured for MANUAL_START, sync will not start until the user
24 // completes sync setup, at which point the UI makes an explicit call to 26 // completes sync setup, at which point the UI makes an explicit call to
25 // complete sync setup. 27 // complete sync setup.
26 enum ProfileSyncServiceStartBehavior { 28 enum ProfileSyncServiceStartBehavior {
27 AUTO_START, 29 AUTO_START,
28 MANUAL_START, 30 MANUAL_START,
29 }; 31 };
30 32
31 // This class is used by ProfileSyncService to manage all logic and state 33 // This class is used by ProfileSyncService to manage all logic and state
32 // pertaining to initialization of the SyncBackendHost (colloquially referred 34 // pertaining to initialization of the SyncBackendHost (colloquially referred
33 // to as "the backend"). 35 // to as "the backend").
34 class StartupController { 36 class StartupController {
35 public: 37 public:
36 StartupController(ProfileSyncServiceStartBehavior start_behavior, 38 StartupController(ProfileSyncServiceStartBehavior start_behavior,
37 const ProfileOAuth2TokenService* token_service, 39 const ProfileOAuth2TokenService* token_service,
38 const browser_sync::SyncPrefs* sync_prefs, 40 const sync_driver::SyncPrefs* sync_prefs,
39 const ManagedUserSigninManagerWrapper* signin, 41 const ManagedUserSigninManagerWrapper* signin,
40 base::Closure start_backend); 42 base::Closure start_backend);
41 ~StartupController(); 43 ~StartupController();
42 44
43 // Starts up sync if it is not suppressed and preconditions are met. 45 // Starts up sync if it is not suppressed and preconditions are met.
44 // Returns true if these preconditions are met, although does not imply 46 // Returns true if these preconditions are met, although does not imply
45 // the backend was started. 47 // the backend was started.
46 bool TryStart(); 48 bool TryStart();
47 49
48 // Called when a datatype (SyncableService) has a need for sync to start 50 // Called when a datatype (SyncableService) has a need for sync to start
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // If |true|, there is setup UI visible so we should not start downloading 89 // If |true|, there is setup UI visible so we should not start downloading
88 // data types. 90 // data types.
89 bool setup_in_progress_; 91 bool setup_in_progress_;
90 92
91 // If true, we want to automatically start sync signin whenever we have 93 // If true, we want to automatically start sync signin whenever we have
92 // credentials (user doesn't need to go through the startup flow). This is 94 // credentials (user doesn't need to go through the startup flow). This is
93 // typically enabled on platforms (like ChromeOS) that have their own 95 // typically enabled on platforms (like ChromeOS) that have their own
94 // distinct signin flow. 96 // distinct signin flow.
95 const bool auto_start_enabled_; 97 const bool auto_start_enabled_;
96 98
97 const browser_sync::SyncPrefs* sync_prefs_; 99 const sync_driver::SyncPrefs* sync_prefs_;
98 100
99 const ProfileOAuth2TokenService* token_service_; 101 const ProfileOAuth2TokenService* token_service_;
100 102
101 const ManagedUserSigninManagerWrapper* signin_; 103 const ManagedUserSigninManagerWrapper* signin_;
102 104
103 // The callback we invoke when it's time to call expensive 105 // The callback we invoke when it's time to call expensive
104 // startup routines for the sync backend. 106 // startup routines for the sync backend.
105 base::Closure start_backend_; 107 base::Closure start_backend_;
106 108
107 // The time at which we invoked the start_backend_ callback. 109 // The time at which we invoked the start_backend_ callback.
108 base::Time start_backend_time_; 110 base::Time start_backend_time_;
109 111
110 base::TimeDelta fallback_timeout_; 112 base::TimeDelta fallback_timeout_;
111 113
112 // Used to compute preferred_types from SyncPrefs as-needed. 114 // Used to compute preferred_types from SyncPrefs as-needed.
113 syncer::ModelTypeSet registered_types_; 115 syncer::ModelTypeSet registered_types_;
114 116
115 base::WeakPtrFactory<StartupController> weak_factory_; 117 base::WeakPtrFactory<StartupController> weak_factory_;
116 }; 118 };
117 119
118 } // namespace browser_sync 120 } // namespace browser_sync
119 121
120 #endif // CHROME_BROWSER_SYNC_STARTUP_CONTROLLER_H_ 122 #endif // CHROME_BROWSER_SYNC_STARTUP_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions2/sessions_sync_manager.h ('k') | chrome/browser/sync/startup_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698