blob: 8ff579b4170bb1631516a18f489f44024ee92723 [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]e8234d32010-09-09 20:36:3918#include "chrome/browser/sync/engine/syncapi.h"
[email protected]72a31b42010-02-17 22:26:3319#include "chrome/browser/sync/glue/data_type_controller.h"
[email protected]e3e43d92010-02-26 22:02:3820#include "chrome/browser/sync/glue/data_type_manager.h"
[email protected]5edb9222010-08-18 00:23:2921#include "chrome/browser/sync/glue/session_model_associator.h"
[email protected]132c85652009-08-05 01:18:2722#include "chrome/browser/sync/glue/sync_backend_host.h"
[email protected]d3b98c82010-07-14 07:45:5923#include "chrome/browser/sync/profile_sync_service_observer.h"
[email protected]e8234d32010-09-09 20:36:3924#include "chrome/browser/sync/signin_manager.h"
[email protected]d80033e2009-10-16 10:32:0425#include "chrome/browser/sync/sync_setup_wizard.h"
[email protected]4aea04a2010-02-10 20:13:4326#include "chrome/browser/sync/syncable/model_type.h"
[email protected]eafb2182010-03-03 00:46:3127#include "chrome/browser/sync/unrecoverable_error_handler.h"
[email protected]99074c52010-08-19 18:44:1928#include "chrome/common/net/gaia/google_service_auth_error.h"
[email protected]c4c672a2010-03-23 21:47:0429#include "chrome/common/notification_observer.h"
30#include "chrome/common/notification_registrar.h"
[email protected]132c85652009-08-05 01:18:2731#include "googleurl/src/gurl.h"
[email protected]33cd0042010-09-08 19:25:2832#include "jingle/notifier/base/notifier_options.h"
[email protected]132c85652009-08-05 01:18:2733
[email protected]c4c672a2010-03-23 21:47:0434class NotificationDetails;
35class NotificationSource;
36class NotificationType;
[email protected]942690b132010-05-11 06:42:1437class Profile;
38class ProfileSyncFactory;
[email protected]e8234d32010-09-09 20:36:3939class TokenMigrator;
[email protected]c4c672a2010-03-23 21:47:0440
[email protected]132c85652009-08-05 01:18:2741// ProfileSyncService is the layer between browser subsystems like bookmarks,
[email protected]a1c2aef62010-04-02 02:58:0542// and the sync backend. Each subsystem is logically thought of as being
43// a sync datatype.
44//
45// Individual datatypes can, at any point, be in a variety of stages of being
46// "enabled". Here are some specific terms for concepts used in this class:
47//
48// 'Registered' (feature suppression for a datatype)
49//
50// When a datatype is registered, the user has the option of syncing it.
51// The sync opt-in UI will show only registered types; a checkbox should
52// never be shown for an unregistered type, and nor should it ever be
53// synced.
54//
55// A datatype is considered registered once RegisterDataTypeController
56// has been called with that datatype's DataTypeController.
57//
58// 'Preferred' (user preferences and opt-out for a datatype)
59//
60// This means the user's opt-in or opt-out preference on a per-datatype
61// basis. The sync service will try to make active exactly these types.
62// If a user has opted out of syncing a particular datatype, it will
63// be registered, but not preferred.
64//
65// This state is controlled by the ConfigurePreferredDataTypes and
66// GetPreferredDataTypes. They are stored in the preferences system,
67// and persist; though if a datatype is not registered, it cannot
68// be a preferred datatype.
69//
70// 'Active' (run-time initialization of sync system for a datatype)
71//
72// An active datatype is a preferred datatype that is actively being
73// synchronized: the syncer has been instructed to querying the server
74// for this datatype, first-time merges have finished, and there is an
75// actively installed ChangeProcessor that listens for changes to this
76// datatype, propagating such changes into and out of the sync backend
77// as necessary.
78//
79// When a datatype is in the process of becoming active, it may be
80// in some intermediate state. Those finer-grained intermediate states
81// are differentiated by the DataTypeController state.
82//
[email protected]4aea04a2010-02-10 20:13:4383class ProfileSyncService : public browser_sync::SyncFrontend,
[email protected]c4c672a2010-03-23 21:47:0484 public browser_sync::UnrecoverableErrorHandler,
85 public NotificationObserver {
[email protected]132c85652009-08-05 01:18:2786 public:
87 typedef ProfileSyncServiceObserver Observer;
88 typedef browser_sync::SyncBackendHost::Status Status;
89
[email protected]1f97a112009-08-11 02:17:0690 enum SyncEventCodes {
91 MIN_SYNC_EVENT_CODE = 0,
92
93 // Events starting the sync service.
94 START_FROM_NTP = 1, // Sync was started from the ad in NTP
95 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu.
96 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options.
[email protected]b220d13f2009-10-09 04:12:4697 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager.
[email protected]1f97a112009-08-11 02:17:0698
[email protected]a7ab8332010-03-31 20:49:0499 // Events regarding cancellation of the signon process of sync.
[email protected]8ac2dc112009-10-01 23:19:13100 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting
[email protected]1f97a112009-08-11 02:17:06101 // username and password.
102 CANCEL_DURING_SIGNON = 11, // Cancelled after auth.
[email protected]8c94d632010-06-25 22:38:00103 CANCEL_FROM_CHOOSE_DATA_TYPES = 12, // Cancelled before choosing data
104 // types and clicking OK.
[email protected]1f97a112009-08-11 02:17:06105 // Events resulting in the stoppage of sync service.
106 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options.
107
108 // Miscellaneous events caused by sync service.
[email protected]1f97a112009-08-11 02:17:06109
110 MAX_SYNC_EVENT_CODE
111 };
112
[email protected]f66bcdf2010-05-17 20:31:14113 // Default sync server URL.
114 static const char* kSyncServerUrl;
115 // Sync server URL for dev channel users
116 static const char* kDevServerUrl;
117
[email protected]e3e43d92010-02-26 22:02:38118 ProfileSyncService(ProfileSyncFactory* factory_,
119 Profile* profile,
[email protected]e8234d32010-09-09 20:36:39120 const std::string& cros_user);
[email protected]132c85652009-08-05 01:18:27121 virtual ~ProfileSyncService();
122
123 // Initializes the object. This should be called every time an object of this
124 // class is constructed.
125 void Initialize();
126
[email protected]e8234d32010-09-09 20:36:39127 void RegisterAuthNotifications();
128
129 // Return whether all sync tokens are loaded and
130 // available for the backend to start up.
131 bool AreCredentialsAvailable();
132
133 // Loads credentials migrated from the old user settings db.
134 void LoadMigratedCredentials(const std::string& username,
135 const std::string& token);
136
[email protected]4aea04a2010-02-10 20:13:43137 // Registers a data type controller with the sync service. This
138 // makes the data type controller available for use, it does not
139 // enable or activate the synchronization of the data type (see
140 // ActivateDataType). Takes ownership of the pointer.
141 void RegisterDataTypeController(
142 browser_sync::DataTypeController* data_type_controller);
143
[email protected]5edb9222010-08-18 00:23:29144 // Returns the session model associator associated with this type, but only if
145 // the associator is running. If it is doing anything else, it will return
146 // null.
147 browser_sync::SessionModelAssociator* GetSessionModelAssociator();
148
[email protected]a7ab8332010-03-31 20:49:04149 // Fills state_map with a map of current data types that are possible to
150 // sync, as well as their states.
151 void GetDataTypeControllerStates(
152 browser_sync::DataTypeController::StateMap* state_map) const;
[email protected]4aea04a2010-02-10 20:13:43153
[email protected]e8234d32010-09-09 20:36:39154 // Disables sync for user. Use ShowLoginDialog to enable.
[email protected]132c85652009-08-05 01:18:27155 virtual void DisableForUser();
156
[email protected]1ce52aa2010-09-08 19:07:36157 // Clears all Chromesync data from the server.
158 void ClearServerData();
159
[email protected]132c85652009-08-05 01:18:27160 // Whether sync is enabled by user or not.
[email protected]4772b072010-03-30 17:45:46161 virtual bool HasSyncSetupCompleted() const;
[email protected]48352c12009-08-15 01:19:11162 void SetSyncSetupCompleted();
[email protected]132c85652009-08-05 01:18:27163
[email protected]132c85652009-08-05 01:18:27164 // SyncFrontend implementation.
165 virtual void OnBackendInitialized();
166 virtual void OnSyncCycleCompleted();
167 virtual void OnAuthError();
[email protected]7f8abea2010-07-14 01:31:36168 virtual void OnStopSyncingPermanently();
[email protected]1ce52aa2010-09-08 19:07:36169 virtual void OnClearServerDataFailed();
170 virtual void OnClearServerDataSucceeded();
[email protected]132c85652009-08-05 01:18:27171
172 // Called when a user enters credentials through UI.
173 virtual void OnUserSubmittedAuth(const std::string& username,
[email protected]1fc9b3f2009-11-12 21:22:09174 const std::string& password,
175 const std::string& captcha);
[email protected]132c85652009-08-05 01:18:27176
[email protected]e8234d32010-09-09 20:36:39177 // Update the last auth error and notify observers of error state.
178 void UpdateAuthErrorState(const GoogleServiceAuthError& error);
179
[email protected]af909492010-06-10 18:45:38180 // Called when a user chooses which data types to sync as part of the sync
181 // setup wizard. |sync_everything| represents whether they chose the
[email protected]8c94d632010-06-25 22:38:00182 // "keep everything synced" option; if true, |chosen_types| will be ignored
183 // and all data types will be synced. |sync_everything| means "sync all
184 // current and future data types."
[email protected]af909492010-06-10 18:45:38185 virtual void OnUserChoseDatatypes(bool sync_everything,
[email protected]8c94d632010-06-25 22:38:00186 const syncable::ModelTypeSet& chosen_types);
[email protected]af909492010-06-10 18:45:38187
[email protected]a7ab8332010-03-31 20:49:04188 // Called when a user cancels any setup dialog (login, etc).
[email protected]132c85652009-08-05 01:18:27189 virtual void OnUserCancelledDialog();
190
191 // Get various information for displaying in the user interface.
192 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary();
193 browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus();
194
[email protected]712257e2009-11-11 22:57:46195 const GoogleServiceAuthError& GetAuthError() const {
[email protected]132c85652009-08-05 01:18:27196 return last_auth_error_;
197 }
198
199 // Displays a dialog for the user to enter GAIA credentials and attempt
200 // re-authentication, and returns true if it actually opened the dialog.
201 // Returns false if a dialog is already showing, an auth attempt is in
202 // progress, the sync system is already authenticated, or some error
203 // occurred preventing the action. We make it the duty of ProfileSyncService
204 // to open the dialog to easily ensure only one is ever showing.
[email protected]666ee732010-07-23 23:52:16205 bool SetupInProgress() const;
[email protected]44b78f90a2009-10-15 17:32:20206 bool WizardIsVisible() const {
207 return wizard_.IsVisible();
208 }
[email protected]fbfc2ec2010-07-16 17:00:42209 void ShowLoginDialog(gfx::NativeWindow parent_window);
[email protected]132c85652009-08-05 01:18:27210
[email protected]fbfc2ec2010-07-16 17:00:42211 void ShowChooseDataTypes(gfx::NativeWindow parent_window);
[email protected]8c94d632010-06-25 22:38:00212
[email protected]132c85652009-08-05 01:18:27213 // Pretty-printed strings for a given StatusSummary.
[email protected]066146872010-08-05 00:55:08214 static std::string BuildSyncStatusSummaryText(
[email protected]132c85652009-08-05 01:18:27215 const browser_sync::SyncBackendHost::StatusSummary& summary);
216
217 // Returns true if the SyncBackendHost has told us it's ready to accept
218 // changes.
219 // TODO(timsteele): What happens if the bookmark model is loaded, a change
220 // takes place, and the backend isn't initialized yet?
221 bool sync_initialized() const { return backend_initialized_; }
[email protected]fb42c982009-09-16 22:33:33222 bool unrecoverable_error_detected() const {
223 return unrecoverable_error_detected_;
224 }
[email protected]f6ec8b22010-06-08 23:40:06225 const std::string& unrecoverable_error_message() {
226 return unrecoverable_error_message_;
227 }
228 tracked_objects::Location unrecoverable_error_location() {
229 return unrecoverable_error_location_.get() ?
230 *unrecoverable_error_location_.get() : tracked_objects::Location();
231 }
[email protected]132c85652009-08-05 01:18:27232
233 bool UIShouldDepictAuthInProgress() const {
234 return is_auth_in_progress_;
235 }
236
237 // A timestamp marking the last time the service observed a transition from
238 // the SYNCING state to the READY state. Note that this does not reflect the
239 // last time we polled the server to see if there were any changes; the
240 // timestamp is only snapped when syncing takes place and we download or
241 // upload some bookmark entity.
242 const base::Time& last_synced_time() const { return last_synced_time_; }
243
244 // Returns a user-friendly string form of last synced time (in minutes).
[email protected]066146872010-08-05 00:55:08245 string16 GetLastSyncedTimeString() const;
[email protected]132c85652009-08-05 01:18:27246
247 // Returns the authenticated username of the sync user, or empty if none
248 // exists. It will only exist if the authentication service provider (e.g
249 // GAIA) has confirmed the username is authentic.
250 virtual string16 GetAuthenticatedUsername() const;
251
252 const std::string& last_attempted_user_email() const {
253 return last_attempted_user_email_;
254 }
255
256 // The profile we are syncing for.
257 Profile* profile() { return profile_; }
258
259 // Adds/removes an observer. ProfileSyncService does not take ownership of
260 // the observer.
[email protected]4772b072010-03-30 17:45:46261 virtual void AddObserver(Observer* observer);
262 virtual void RemoveObserver(Observer* observer);
[email protected]132c85652009-08-05 01:18:27263
[email protected]1f97a112009-08-11 02:17:06264 // Record stats on various events.
265 static void SyncEvent(SyncEventCodes code);
266
[email protected]eec3bcfa2009-11-12 17:23:43267 // Returns whether sync is enabled. Sync can be enabled/disabled both
268 // at compile time (e.g., on a per-OS basis) or at run time (e.g.,
269 // command-line switches).
270 static bool IsSyncEnabled();
271
[email protected]d3b98c82010-07-14 07:45:59272 // Retuns whether sync is managed, i.e. controlled by configuration
273 // management. If so, the user is not allowed to configure sync.
274 bool IsManaged();
275
[email protected]db1df0f2009-08-18 22:36:05276 // UnrecoverableErrorHandler implementation.
[email protected]f6ec8b22010-06-08 23:40:06277 virtual void OnUnrecoverableError(
278 const tracked_objects::Location& from_here,
279 const std::string& message);
[email protected]db1df0f2009-08-18 22:36:05280
281 browser_sync::SyncBackendHost* backend() { return backend_.get(); }
282
[email protected]4aea04a2010-02-10 20:13:43283 virtual void ActivateDataType(
284 browser_sync::DataTypeController* data_type_controller,
285 browser_sync::ChangeProcessor* change_processor);
286 virtual void DeactivateDataType(
287 browser_sync::DataTypeController* data_type_controller,
288 browser_sync::ChangeProcessor* change_processor);
289
[email protected]c4c672a2010-03-23 21:47:04290 // NotificationObserver implementation.
291 virtual void Observe(NotificationType type,
292 const NotificationSource& source,
293 const NotificationDetails& details);
294
[email protected]a1c2aef62010-04-02 02:58:05295 // Changes which data types we're going to be syncing to |preferred_types|.
296 // If it is running, the DataTypeManager will be instructed to reconfigure
297 // the sync backend so that exactly these datatypes are actively synced. See
298 // class comment for more on what it means for a datatype to be Preferred.
299 virtual void ChangePreferredDataTypes(
300 const syncable::ModelTypeSet& preferred_types);
301
302 // Get the set of currently enabled data types (as chosen or configured by
303 // the user). See class comment for more on what it means for a datatype
304 // to be Preferred.
305 virtual void GetPreferredDataTypes(
306 syncable::ModelTypeSet* preferred_types) const;
307
308 // Gets the set of all data types that could be allowed (the set that
309 // should be advertised to the user). These will typically only change
310 // via a command-line option. See class comment for more on what it means
311 // for a datatype to be Registered.
312 virtual void GetRegisteredDataTypes(
313 syncable::ModelTypeSet* registered_types) const;
[email protected]a7ab8332010-03-31 20:49:04314
[email protected]ff0aa752010-06-10 22:40:52315 // Checks whether the Cryptographer is ready to encrypt and decrypt updates
316 // for sensitive data types.
317 virtual bool IsCryptographerReady() const;
318
[email protected]bb899b3f2010-06-23 21:35:32319 // Sets the Cryptographer's passphrase. This will check asynchronously whether
320 // the passphrase is valid and notify ProfileSyncServiceObservers via the
321 // NotificationService when the outcome is known.
322 virtual void SetPassphrase(const std::string& passphrase);
323
[email protected]5edb9222010-08-18 00:23:29324 // Returns whether processing changes is allowed. Check this before doing
325 // any model-modifying operations.
326 bool ShouldPushChanges();
327
[email protected]9a127f22010-09-17 21:05:16328 const GURL& sync_service_url() const { return sync_service_url_; }
329
[email protected]132c85652009-08-05 01:18:27330 protected:
[email protected]82d9d2952010-05-15 00:36:16331 // Used by ProfileSyncServiceMock only.
332 //
333 // TODO(akalin): Separate this class out into an abstract
334 // ProfileSyncService interface and a ProfileSyncServiceImpl class
335 // so we don't need this hack anymore.
336 ProfileSyncService();
337
[email protected]7cef1c442010-07-07 17:05:22338 // Helper to install and configure a data type manager.
339 void ConfigureDataTypeManager();
[email protected]132c85652009-08-05 01:18:27340
[email protected]132c85652009-08-05 01:18:27341 // Starts up the backend sync components.
342 void StartUp();
343 // Shuts down the backend sync components.
344 // |sync_disabled| indicates if syncing is being disabled or not.
345 void Shutdown(bool sync_disabled);
346
[email protected]48352c12009-08-15 01:19:11347 // Methods to register and remove preferences.
348 void RegisterPreferences();
349 void ClearPreferences();
350
[email protected]e8234d32010-09-09 20:36:39351 // Return SyncCredentials from the TokenService.
352 sync_api::SyncCredentials GetCredentials();
353
[email protected]18af9a22010-08-11 00:47:19354 // Test need to override this to create backends that allow setting up
355 // initial conditions, such as populating sync nodes.
356 virtual void CreateBackend();
[email protected]132c85652009-08-05 01:18:27357
[email protected]7cef1c442010-07-07 17:05:22358 const browser_sync::DataTypeController::TypeMap& data_type_controllers() {
359 return data_type_controllers_;
360 }
361
[email protected]e8234d32010-09-09 20:36:39362 // The wizard will try to read the auth state out of the profile sync
363 // service using this member. Captcha and error state are reflected.
[email protected]712257e2009-11-11 22:57:46364 GoogleServiceAuthError last_auth_error_;
[email protected]132c85652009-08-05 01:18:27365
[email protected]7cef1c442010-07-07 17:05:22366 // Our asynchronous backend to communicate with sync components living on
367 // other threads.
368 scoped_ptr<browser_sync::SyncBackendHost> backend_;
369
[email protected]132c85652009-08-05 01:18:27370 // Cache of the last name the client attempted to authenticate.
371 std::string last_attempted_user_email_;
372
373 private:
[email protected]132c85652009-08-05 01:18:27374 friend class ProfileSyncServiceTest;
[email protected]4f5732a42010-09-21 22:39:09375 friend class ProfileSyncServicePasswordTest;
[email protected]65b3aa12010-02-22 22:49:00376 friend class ProfileSyncServicePreferenceTest;
[email protected]5edb9222010-08-18 00:23:29377 friend class ProfileSyncServiceSessionTest;
[email protected]132c85652009-08-05 01:18:27378 friend class ProfileSyncServiceTestHarness;
[email protected]61b694a2010-06-10 10:40:46379 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
380 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest,
381 UnrecoverableErrorSuspendsService);
[email protected]132c85652009-08-05 01:18:27382
[email protected]18af9a22010-08-11 00:47:19383 // If |delete_sync_data_folder| is true, then this method will delete all
384 // previous "Sync Data" folders. (useful if the folder is partial/corrupt).
385 void InitializeBackend(bool delete_sync_data_folder);
386
[email protected]132c85652009-08-05 01:18:27387 // Initializes the various settings from the command line.
388 void InitSettings();
389
[email protected]132c85652009-08-05 01:18:27390 // Sets the last synced time to the current time.
391 void UpdateLastSyncedTime();
392
[email protected]57ecc4b2010-08-11 03:02:51393 static const char* GetPrefNameForDataType(syncable::ModelType data_type);
[email protected]a1c2aef62010-04-02 02:58:05394
[email protected]cb4c06e2009-08-22 00:24:39395 // Time at which we begin an attempt a GAIA authorization.
396 base::TimeTicks auth_start_time_;
397
398 // Time at which error UI is presented for the new tab page.
[email protected]1f97a112009-08-11 02:17:06399 base::TimeTicks auth_error_time_;
400
[email protected]e3e43d92010-02-26 22:02:38401 // Factory used to create various dependent objects.
402 ProfileSyncFactory* factory_;
403
[email protected]132c85652009-08-05 01:18:27404 // The profile whose data we are synchronizing.
405 Profile* profile_;
406
[email protected]e8234d32010-09-09 20:36:39407 // Email for the ChromiumOS user, if we're running under ChromiumOS.
408 std::string cros_user_;
[email protected]72a31b42010-02-17 22:26:33409
[email protected]132c85652009-08-05 01:18:27410 // TODO(ncarter): Put this in a profile, once there is UI for it.
411 // This specifies where to find the sync server.
412 GURL sync_service_url_;
413
[email protected]132c85652009-08-05 01:18:27414 // The last time we detected a successful transition from SYNCING state.
415 // Our backend notifies us whenever we should take a new snapshot.
416 base::Time last_synced_time_;
417
[email protected]4aea04a2010-02-10 20:13:43418 // List of available data type controllers.
[email protected]72a31b42010-02-17 22:26:33419 browser_sync::DataTypeController::TypeMap data_type_controllers_;
[email protected]db1df0f2009-08-18 22:36:05420
[email protected]132c85652009-08-05 01:18:27421 // Whether the SyncBackendHost has been initialized.
422 bool backend_initialized_;
423
[email protected]132c85652009-08-05 01:18:27424 // Various pieces of UI query this value to determine if they should show
425 // an "Authenticating.." type of message. We are the only central place
426 // all auth attempts funnel through, so it makes sense to provide this.
427 // As its name suggests, this should NOT be used for anything other than UI.
428 bool is_auth_in_progress_;
429
[email protected]44b78f90a2009-10-15 17:32:20430 SyncSetupWizard wizard_;
431
[email protected]e8234d32010-09-09 20:36:39432 // Encapsulates user signin with TokenService.
433 SigninManager signin_;
434
[email protected]132c85652009-08-05 01:18:27435 // True if an unrecoverable error (e.g. violation of an assumed invariant)
436 // occurred during syncer operation. This value should be checked before
437 // doing any work that might corrupt things further.
438 bool unrecoverable_error_detected_;
439
[email protected]f6ec8b22010-06-08 23:40:06440 // A message sent when an unrecoverable error occurred.
441 std::string unrecoverable_error_message_;
442 scoped_ptr<tracked_objects::Location> unrecoverable_error_location_;
443
[email protected]33cd0042010-09-08 19:25:28444 // Contains options specific to how sync clients send and listen to
445 // notifications.
446 notifier::NotifierOptions notifier_options_;
[email protected]93d960ce2010-02-11 04:27:00447
[email protected]e3e43d92010-02-26 22:02:38448 // Manages the start and stop of the various data types.
449 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_;
450
[email protected]132c85652009-08-05 01:18:27451 ObserverList<Observer> observers_;
452
[email protected]c4c672a2010-03-23 21:47:04453 NotificationRegistrar registrar_;
454
[email protected]2be7bf22010-04-23 21:02:37455 ScopedRunnableMethodFactory<ProfileSyncService>
456 scoped_runnable_method_factory_;
457
[email protected]d3b98c82010-07-14 07:45:59458 // The preference that controls whether sync is under control by configuration
459 // management.
460 BooleanPrefMember pref_sync_managed_;
461
[email protected]a47eeb52010-07-15 17:54:25462 // This allows us to gracefully handle an ABORTED return code from the
463 // DataTypeManager in the event that the server informed us to cease and
464 // desist syncing immediately.
465 bool expect_sync_configuration_aborted_;
466
[email protected]e8234d32010-09-09 20:36:39467 scoped_ptr<TokenMigrator> token_migrator_;
468
[email protected]48a98b32010-09-17 20:26:59469 // Sometimes we need to temporarily hold on to a passphrase because we don't
470 // yet have a backend to send it to. This happens during initialization as
471 // we don't StartUp until we have a valid token, which happens after valid
472 // credentials were provided.
473 std::string cached_passphrase_;
474
[email protected]132c85652009-08-05 01:18:27475 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
476};
477
478#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_