blob: ac64c94cc398b97d7e95d4d5ed1ad818b42fc61b [file] [log] [blame]
[email protected]66761b952010-06-25 21:30:381// Copyright (c) 2010 The Chromium Authors. All rights reserved.
[email protected]132c85652009-08-05 01:18:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]132c85652009-08-05 01:18:275#ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6#define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
[email protected]32b76ef2010-07-26 23:08:247#pragma once
[email protected]132c85652009-08-05 01:18:278
9#include <string>
[email protected]132c85652009-08-05 01:18:2710
11#include "base/basictypes.h"
[email protected]61b694a2010-06-10 10:40:4612#include "base/gtest_prod_util.h"
[email protected]132c85652009-08-05 01:18:2713#include "base/observer_list.h"
14#include "base/scoped_ptr.h"
[email protected]066146872010-08-05 00:55:0815#include "base/string16.h"
[email protected]4aea04a2010-02-10 20:13:4316#include "base/time.h"
[email protected]37858e52010-08-26 00:22:0217#include "chrome/browser/prefs/pref_member.h"
[email protected]72a31b42010-02-17 22:26:3318#include "chrome/browser/sync/glue/data_type_controller.h"
[email protected]e3e43d92010-02-26 22:02:3819#include "chrome/browser/sync/glue/data_type_manager.h"
[email protected]5edb9222010-08-18 00:23:2920#include "chrome/browser/sync/glue/session_model_associator.h"
[email protected]132c85652009-08-05 01:18:2721#include "chrome/browser/sync/glue/sync_backend_host.h"
[email protected]a1c62682010-09-07 22:43:0522#include "chrome/browser/sync/notification_method.h"
[email protected]d3b98c82010-07-14 07:45:5923#include "chrome/browser/sync/profile_sync_service_observer.h"
[email protected]d80033e2009-10-16 10:32:0424#include "chrome/browser/sync/sync_setup_wizard.h"
[email protected]4aea04a2010-02-10 20:13:4325#include "chrome/browser/sync/syncable/model_type.h"
[email protected]eafb2182010-03-03 00:46:3126#include "chrome/browser/sync/unrecoverable_error_handler.h"
[email protected]99074c52010-08-19 18:44:1927#include "chrome/common/net/gaia/google_service_auth_error.h"
[email protected]c4c672a2010-03-23 21:47:0428#include "chrome/common/notification_observer.h"
29#include "chrome/common/notification_registrar.h"
[email protected]132c85652009-08-05 01:18:2730#include "googleurl/src/gurl.h"
31
[email protected]c4c672a2010-03-23 21:47:0432class NotificationDetails;
33class NotificationSource;
34class NotificationType;
[email protected]942690b132010-05-11 06:42:1435class Profile;
36class ProfileSyncFactory;
[email protected]c4c672a2010-03-23 21:47:0437
[email protected]132c85652009-08-05 01:18:2738// ProfileSyncService is the layer between browser subsystems like bookmarks,
[email protected]a1c2aef62010-04-02 02:58:0539// and the sync backend. Each subsystem is logically thought of as being
40// a sync datatype.
41//
42// Individual datatypes can, at any point, be in a variety of stages of being
43// "enabled". Here are some specific terms for concepts used in this class:
44//
45// 'Registered' (feature suppression for a datatype)
46//
47// When a datatype is registered, the user has the option of syncing it.
48// The sync opt-in UI will show only registered types; a checkbox should
49// never be shown for an unregistered type, and nor should it ever be
50// synced.
51//
52// A datatype is considered registered once RegisterDataTypeController
53// has been called with that datatype's DataTypeController.
54//
55// 'Preferred' (user preferences and opt-out for a datatype)
56//
57// This means the user's opt-in or opt-out preference on a per-datatype
58// basis. The sync service will try to make active exactly these types.
59// If a user has opted out of syncing a particular datatype, it will
60// be registered, but not preferred.
61//
62// This state is controlled by the ConfigurePreferredDataTypes and
63// GetPreferredDataTypes. They are stored in the preferences system,
64// and persist; though if a datatype is not registered, it cannot
65// be a preferred datatype.
66//
67// 'Active' (run-time initialization of sync system for a datatype)
68//
69// An active datatype is a preferred datatype that is actively being
70// synchronized: the syncer has been instructed to querying the server
71// for this datatype, first-time merges have finished, and there is an
72// actively installed ChangeProcessor that listens for changes to this
73// datatype, propagating such changes into and out of the sync backend
74// as necessary.
75//
76// When a datatype is in the process of becoming active, it may be
77// in some intermediate state. Those finer-grained intermediate states
78// are differentiated by the DataTypeController state.
79//
[email protected]4aea04a2010-02-10 20:13:4380class ProfileSyncService : public browser_sync::SyncFrontend,
[email protected]c4c672a2010-03-23 21:47:0481 public browser_sync::UnrecoverableErrorHandler,
82 public NotificationObserver {
[email protected]132c85652009-08-05 01:18:2783 public:
84 typedef ProfileSyncServiceObserver Observer;
85 typedef browser_sync::SyncBackendHost::Status Status;
86
[email protected]1f97a112009-08-11 02:17:0687 enum SyncEventCodes {
88 MIN_SYNC_EVENT_CODE = 0,
89
90 // Events starting the sync service.
91 START_FROM_NTP = 1, // Sync was started from the ad in NTP
92 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu.
93 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options.
[email protected]b220d13f2009-10-09 04:12:4694 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager.
[email protected]1f97a112009-08-11 02:17:0695
[email protected]a7ab8332010-03-31 20:49:0496 // Events regarding cancellation of the signon process of sync.
[email protected]8ac2dc112009-10-01 23:19:1397 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting
[email protected]1f97a112009-08-11 02:17:0698 // username and password.
99 CANCEL_DURING_SIGNON = 11, // Cancelled after auth.
[email protected]8c94d632010-06-25 22:38:00100 CANCEL_FROM_CHOOSE_DATA_TYPES = 12, // Cancelled before choosing data
101 // types and clicking OK.
[email protected]1f97a112009-08-11 02:17:06102 // Events resulting in the stoppage of sync service.
103 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options.
104
105 // Miscellaneous events caused by sync service.
[email protected]1f97a112009-08-11 02:17:06106
107 MAX_SYNC_EVENT_CODE
108 };
109
[email protected]f66bcdf2010-05-17 20:31:14110 // Default sync server URL.
111 static const char* kSyncServerUrl;
112 // Sync server URL for dev channel users
113 static const char* kDevServerUrl;
114
[email protected]e3e43d92010-02-26 22:02:38115 ProfileSyncService(ProfileSyncFactory* factory_,
116 Profile* profile,
[email protected]265d8c322010-09-08 01:38:35117 bool bootstrap_sync_authentication);
[email protected]132c85652009-08-05 01:18:27118 virtual ~ProfileSyncService();
119
120 // Initializes the object. This should be called every time an object of this
121 // class is constructed.
122 void Initialize();
123
[email protected]4aea04a2010-02-10 20:13:43124 // Registers a data type controller with the sync service. This
125 // makes the data type controller available for use, it does not
126 // enable or activate the synchronization of the data type (see
127 // ActivateDataType). Takes ownership of the pointer.
128 void RegisterDataTypeController(
129 browser_sync::DataTypeController* data_type_controller);
130
[email protected]5edb9222010-08-18 00:23:29131 // Returns the session model associator associated with this type, but only if
132 // the associator is running. If it is doing anything else, it will return
133 // null.
134 browser_sync::SessionModelAssociator* GetSessionModelAssociator();
135
[email protected]a7ab8332010-03-31 20:49:04136 // Fills state_map with a map of current data types that are possible to
137 // sync, as well as their states.
138 void GetDataTypeControllerStates(
139 browser_sync::DataTypeController::StateMap* state_map) const;
[email protected]4aea04a2010-02-10 20:13:43140
[email protected]265d8c322010-09-08 01:38:35141 // Enables/disables sync for user.
142 virtual void EnableForUser(gfx::NativeWindow parent_window);
[email protected]132c85652009-08-05 01:18:27143 virtual void DisableForUser();
144
[email protected]1ce52aa2010-09-08 19:07:36145 // Clears all Chromesync data from the server.
146 void ClearServerData();
147
[email protected]132c85652009-08-05 01:18:27148 // Whether sync is enabled by user or not.
[email protected]4772b072010-03-30 17:45:46149 virtual bool HasSyncSetupCompleted() const;
[email protected]48352c12009-08-15 01:19:11150 void SetSyncSetupCompleted();
[email protected]132c85652009-08-05 01:18:27151
[email protected]132c85652009-08-05 01:18:27152 // SyncFrontend implementation.
153 virtual void OnBackendInitialized();
154 virtual void OnSyncCycleCompleted();
155 virtual void OnAuthError();
[email protected]7f8abea2010-07-14 01:31:36156 virtual void OnStopSyncingPermanently();
[email protected]1ce52aa2010-09-08 19:07:36157 virtual void OnClearServerDataFailed();
158 virtual void OnClearServerDataSucceeded();
[email protected]132c85652009-08-05 01:18:27159
160 // Called when a user enters credentials through UI.
161 virtual void OnUserSubmittedAuth(const std::string& username,
[email protected]1fc9b3f2009-11-12 21:22:09162 const std::string& password,
163 const std::string& captcha);
[email protected]132c85652009-08-05 01:18:27164
[email protected]af909492010-06-10 18:45:38165 // Called when a user chooses which data types to sync as part of the sync
166 // setup wizard. |sync_everything| represents whether they chose the
[email protected]8c94d632010-06-25 22:38:00167 // "keep everything synced" option; if true, |chosen_types| will be ignored
168 // and all data types will be synced. |sync_everything| means "sync all
169 // current and future data types."
[email protected]af909492010-06-10 18:45:38170 virtual void OnUserChoseDatatypes(bool sync_everything,
[email protected]8c94d632010-06-25 22:38:00171 const syncable::ModelTypeSet& chosen_types);
[email protected]af909492010-06-10 18:45:38172
[email protected]a7ab8332010-03-31 20:49:04173 // Called when a user cancels any setup dialog (login, etc).
[email protected]132c85652009-08-05 01:18:27174 virtual void OnUserCancelledDialog();
175
176 // Get various information for displaying in the user interface.
177 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary();
178 browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus();
179
[email protected]712257e2009-11-11 22:57:46180 const GoogleServiceAuthError& GetAuthError() const {
[email protected]132c85652009-08-05 01:18:27181 return last_auth_error_;
182 }
183
184 // Displays a dialog for the user to enter GAIA credentials and attempt
185 // re-authentication, and returns true if it actually opened the dialog.
186 // Returns false if a dialog is already showing, an auth attempt is in
187 // progress, the sync system is already authenticated, or some error
188 // occurred preventing the action. We make it the duty of ProfileSyncService
189 // to open the dialog to easily ensure only one is ever showing.
[email protected]666ee732010-07-23 23:52:16190 bool SetupInProgress() const;
[email protected]44b78f90a2009-10-15 17:32:20191 bool WizardIsVisible() const {
192 return wizard_.IsVisible();
193 }
[email protected]fbfc2ec2010-07-16 17:00:42194 void ShowLoginDialog(gfx::NativeWindow parent_window);
[email protected]132c85652009-08-05 01:18:27195
[email protected]fbfc2ec2010-07-16 17:00:42196 void ShowChooseDataTypes(gfx::NativeWindow parent_window);
[email protected]8c94d632010-06-25 22:38:00197
[email protected]132c85652009-08-05 01:18:27198 // Pretty-printed strings for a given StatusSummary.
[email protected]066146872010-08-05 00:55:08199 static std::string BuildSyncStatusSummaryText(
[email protected]132c85652009-08-05 01:18:27200 const browser_sync::SyncBackendHost::StatusSummary& summary);
201
202 // Returns true if the SyncBackendHost has told us it's ready to accept
203 // changes.
204 // TODO(timsteele): What happens if the bookmark model is loaded, a change
205 // takes place, and the backend isn't initialized yet?
206 bool sync_initialized() const { return backend_initialized_; }
[email protected]fb42c982009-09-16 22:33:33207 bool unrecoverable_error_detected() const {
208 return unrecoverable_error_detected_;
209 }
[email protected]f6ec8b22010-06-08 23:40:06210 const std::string& unrecoverable_error_message() {
211 return unrecoverable_error_message_;
212 }
213 tracked_objects::Location unrecoverable_error_location() {
214 return unrecoverable_error_location_.get() ?
215 *unrecoverable_error_location_.get() : tracked_objects::Location();
216 }
[email protected]132c85652009-08-05 01:18:27217
218 bool UIShouldDepictAuthInProgress() const {
219 return is_auth_in_progress_;
220 }
221
222 // A timestamp marking the last time the service observed a transition from
223 // the SYNCING state to the READY state. Note that this does not reflect the
224 // last time we polled the server to see if there were any changes; the
225 // timestamp is only snapped when syncing takes place and we download or
226 // upload some bookmark entity.
227 const base::Time& last_synced_time() const { return last_synced_time_; }
228
229 // Returns a user-friendly string form of last synced time (in minutes).
[email protected]066146872010-08-05 00:55:08230 string16 GetLastSyncedTimeString() const;
[email protected]132c85652009-08-05 01:18:27231
232 // Returns the authenticated username of the sync user, or empty if none
233 // exists. It will only exist if the authentication service provider (e.g
234 // GAIA) has confirmed the username is authentic.
235 virtual string16 GetAuthenticatedUsername() const;
236
237 const std::string& last_attempted_user_email() const {
238 return last_attempted_user_email_;
239 }
240
241 // The profile we are syncing for.
242 Profile* profile() { return profile_; }
243
244 // Adds/removes an observer. ProfileSyncService does not take ownership of
245 // the observer.
[email protected]4772b072010-03-30 17:45:46246 virtual void AddObserver(Observer* observer);
247 virtual void RemoveObserver(Observer* observer);
[email protected]132c85652009-08-05 01:18:27248
[email protected]1f97a112009-08-11 02:17:06249 // Record stats on various events.
250 static void SyncEvent(SyncEventCodes code);
251
[email protected]eec3bcfa2009-11-12 17:23:43252 // Returns whether sync is enabled. Sync can be enabled/disabled both
253 // at compile time (e.g., on a per-OS basis) or at run time (e.g.,
254 // command-line switches).
255 static bool IsSyncEnabled();
256
[email protected]d3b98c82010-07-14 07:45:59257 // Retuns whether sync is managed, i.e. controlled by configuration
258 // management. If so, the user is not allowed to configure sync.
259 bool IsManaged();
260
[email protected]db1df0f2009-08-18 22:36:05261 // UnrecoverableErrorHandler implementation.
[email protected]f6ec8b22010-06-08 23:40:06262 virtual void OnUnrecoverableError(
263 const tracked_objects::Location& from_here,
264 const std::string& message);
[email protected]db1df0f2009-08-18 22:36:05265
266 browser_sync::SyncBackendHost* backend() { return backend_.get(); }
267
[email protected]4aea04a2010-02-10 20:13:43268 virtual void ActivateDataType(
269 browser_sync::DataTypeController* data_type_controller,
270 browser_sync::ChangeProcessor* change_processor);
271 virtual void DeactivateDataType(
272 browser_sync::DataTypeController* data_type_controller,
273 browser_sync::ChangeProcessor* change_processor);
274
[email protected]c4c672a2010-03-23 21:47:04275 // NotificationObserver implementation.
276 virtual void Observe(NotificationType type,
277 const NotificationSource& source,
278 const NotificationDetails& details);
279
[email protected]a1c2aef62010-04-02 02:58:05280 // Changes which data types we're going to be syncing to |preferred_types|.
281 // If it is running, the DataTypeManager will be instructed to reconfigure
282 // the sync backend so that exactly these datatypes are actively synced. See
283 // class comment for more on what it means for a datatype to be Preferred.
284 virtual void ChangePreferredDataTypes(
285 const syncable::ModelTypeSet& preferred_types);
286
287 // Get the set of currently enabled data types (as chosen or configured by
288 // the user). See class comment for more on what it means for a datatype
289 // to be Preferred.
290 virtual void GetPreferredDataTypes(
291 syncable::ModelTypeSet* preferred_types) const;
292
293 // Gets the set of all data types that could be allowed (the set that
294 // should be advertised to the user). These will typically only change
295 // via a command-line option. See class comment for more on what it means
296 // for a datatype to be Registered.
297 virtual void GetRegisteredDataTypes(
298 syncable::ModelTypeSet* registered_types) const;
[email protected]a7ab8332010-03-31 20:49:04299
[email protected]ff0aa752010-06-10 22:40:52300 // Checks whether the Cryptographer is ready to encrypt and decrypt updates
301 // for sensitive data types.
302 virtual bool IsCryptographerReady() const;
303
[email protected]bb899b3f2010-06-23 21:35:32304 // Sets the Cryptographer's passphrase. This will check asynchronously whether
305 // the passphrase is valid and notify ProfileSyncServiceObservers via the
306 // NotificationService when the outcome is known.
307 virtual void SetPassphrase(const std::string& passphrase);
308
[email protected]5edb9222010-08-18 00:23:29309 // Returns whether processing changes is allowed. Check this before doing
310 // any model-modifying operations.
311 bool ShouldPushChanges();
312
[email protected]132c85652009-08-05 01:18:27313 protected:
[email protected]82d9d2952010-05-15 00:36:16314 // Used by ProfileSyncServiceMock only.
315 //
316 // TODO(akalin): Separate this class out into an abstract
317 // ProfileSyncService interface and a ProfileSyncServiceImpl class
318 // so we don't need this hack anymore.
319 ProfileSyncService();
320
[email protected]7cef1c442010-07-07 17:05:22321 // Helper to install and configure a data type manager.
322 void ConfigureDataTypeManager();
[email protected]132c85652009-08-05 01:18:27323
[email protected]132c85652009-08-05 01:18:27324 // Starts up the backend sync components.
325 void StartUp();
326 // Shuts down the backend sync components.
327 // |sync_disabled| indicates if syncing is being disabled or not.
328 void Shutdown(bool sync_disabled);
329
[email protected]48352c12009-08-15 01:19:11330 // Methods to register and remove preferences.
331 void RegisterPreferences();
332 void ClearPreferences();
333
[email protected]18af9a22010-08-11 00:47:19334 // Test need to override this to create backends that allow setting up
335 // initial conditions, such as populating sync nodes.
336 virtual void CreateBackend();
[email protected]132c85652009-08-05 01:18:27337
[email protected]7cef1c442010-07-07 17:05:22338 const browser_sync::DataTypeController::TypeMap& data_type_controllers() {
339 return data_type_controllers_;
340 }
341
[email protected]265d8c322010-09-08 01:38:35342 // We keep track of the last auth error observed so we can cover up the first
343 // "expected" auth failure from observers.
344 // TODO(timsteele): Same as expecting_first_run_auth_needed_event_. Remove
345 // this!
[email protected]712257e2009-11-11 22:57:46346 GoogleServiceAuthError last_auth_error_;
[email protected]132c85652009-08-05 01:18:27347
[email protected]7cef1c442010-07-07 17:05:22348 // Our asynchronous backend to communicate with sync components living on
349 // other threads.
350 scoped_ptr<browser_sync::SyncBackendHost> backend_;
351
[email protected]132c85652009-08-05 01:18:27352 // Cache of the last name the client attempted to authenticate.
353 std::string last_attempted_user_email_;
354
355 private:
[email protected]132c85652009-08-05 01:18:27356 friend class ProfileSyncServiceTest;
[email protected]65b3aa12010-02-22 22:49:00357 friend class ProfileSyncServicePreferenceTest;
[email protected]5edb9222010-08-18 00:23:29358 friend class ProfileSyncServiceSessionTest;
[email protected]132c85652009-08-05 01:18:27359 friend class ProfileSyncServiceTestHarness;
[email protected]61b694a2010-06-10 10:40:46360 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
361 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest,
362 UnrecoverableErrorSuspendsService);
[email protected]132c85652009-08-05 01:18:27363
[email protected]18af9a22010-08-11 00:47:19364 // If |delete_sync_data_folder| is true, then this method will delete all
365 // previous "Sync Data" folders. (useful if the folder is partial/corrupt).
366 void InitializeBackend(bool delete_sync_data_folder);
367
[email protected]132c85652009-08-05 01:18:27368 // Initializes the various settings from the command line.
369 void InitSettings();
370
[email protected]132c85652009-08-05 01:18:27371 // Sets the last synced time to the current time.
372 void UpdateLastSyncedTime();
373
[email protected]57ecc4b2010-08-11 03:02:51374 static const char* GetPrefNameForDataType(syncable::ModelType data_type);
[email protected]a1c2aef62010-04-02 02:58:05375
[email protected]cb4c06e2009-08-22 00:24:39376 // Time at which we begin an attempt a GAIA authorization.
377 base::TimeTicks auth_start_time_;
378
379 // Time at which error UI is presented for the new tab page.
[email protected]1f97a112009-08-11 02:17:06380 base::TimeTicks auth_error_time_;
381
[email protected]e3e43d92010-02-26 22:02:38382 // Factory used to create various dependent objects.
383 ProfileSyncFactory* factory_;
384
[email protected]132c85652009-08-05 01:18:27385 // The profile whose data we are synchronizing.
386 Profile* profile_;
387
[email protected]265d8c322010-09-08 01:38:35388 // True if the profile sync service should attempt to use an LSID
389 // cookie for authentication. This is typically set to true in
390 // ChromiumOS since we want to use the system level authentication
391 // for sync.
392 bool bootstrap_sync_authentication_;
[email protected]72a31b42010-02-17 22:26:33393
[email protected]132c85652009-08-05 01:18:27394 // TODO(ncarter): Put this in a profile, once there is UI for it.
395 // This specifies where to find the sync server.
396 GURL sync_service_url_;
397
[email protected]132c85652009-08-05 01:18:27398 // The last time we detected a successful transition from SYNCING state.
399 // Our backend notifies us whenever we should take a new snapshot.
400 base::Time last_synced_time_;
401
[email protected]4aea04a2010-02-10 20:13:43402 // List of available data type controllers.
[email protected]72a31b42010-02-17 22:26:33403 browser_sync::DataTypeController::TypeMap data_type_controllers_;
[email protected]db1df0f2009-08-18 22:36:05404
[email protected]132c85652009-08-05 01:18:27405 // Whether the SyncBackendHost has been initialized.
406 bool backend_initialized_;
407
[email protected]265d8c322010-09-08 01:38:35408 // Set to true when the user first enables sync, and we are waiting for
409 // syncapi to give us the green light on providing credentials for the first
410 // time. It is set back to false as soon as we get this message, and is
411 // false all other times so we don't have to persist this value as it will
412 // get initialized to false.
413 // TODO(timsteele): Remove this by way of starting the wizard when enabling
414 // sync *before* initializing the backend. syncapi will need to change, but
415 // it means we don't have to wait for the first AuthError; if we ever get
416 // one, it is actually an error and this bool isn't needed.
417 bool expecting_first_run_auth_needed_event_;
418
[email protected]132c85652009-08-05 01:18:27419 // Various pieces of UI query this value to determine if they should show
420 // an "Authenticating.." type of message. We are the only central place
421 // all auth attempts funnel through, so it makes sense to provide this.
422 // As its name suggests, this should NOT be used for anything other than UI.
423 bool is_auth_in_progress_;
424
[email protected]44b78f90a2009-10-15 17:32:20425 SyncSetupWizard wizard_;
426
[email protected]132c85652009-08-05 01:18:27427 // True if an unrecoverable error (e.g. violation of an assumed invariant)
428 // occurred during syncer operation. This value should be checked before
429 // doing any work that might corrupt things further.
430 bool unrecoverable_error_detected_;
431
[email protected]f6ec8b22010-06-08 23:40:06432 // A message sent when an unrecoverable error occurred.
433 std::string unrecoverable_error_message_;
434 scoped_ptr<tracked_objects::Location> unrecoverable_error_location_;
435
[email protected]a1c62682010-09-07 22:43:05436 // Whether to use the (new, untested) Chrome-socket-based
437 // buzz::AsyncSocket implementation for notifications.
438 bool use_chrome_async_socket_;
439
440 // Which peer-to-peer notification method to use.
441 browser_sync::NotificationMethod notification_method_;
[email protected]93d960ce2010-02-11 04:27:00442
[email protected]e3e43d92010-02-26 22:02:38443 // Manages the start and stop of the various data types.
444 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_;
445
[email protected]132c85652009-08-05 01:18:27446 ObserverList<Observer> observers_;
447
[email protected]c4c672a2010-03-23 21:47:04448 NotificationRegistrar registrar_;
449
[email protected]2be7bf22010-04-23 21:02:37450 ScopedRunnableMethodFactory<ProfileSyncService>
451 scoped_runnable_method_factory_;
452
[email protected]d3b98c82010-07-14 07:45:59453 // The preference that controls whether sync is under control by configuration
454 // management.
455 BooleanPrefMember pref_sync_managed_;
456
[email protected]a47eeb52010-07-15 17:54:25457 // This allows us to gracefully handle an ABORTED return code from the
458 // DataTypeManager in the event that the server informed us to cease and
459 // desist syncing immediately.
460 bool expect_sync_configuration_aborted_;
461
[email protected]132c85652009-08-05 01:18:27462 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
463};
464
465#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_