blob: dc3e67d788660d1ce0409509730505f5405eebaf [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]689a7a72010-09-29 19:56:41113 // Keep track of where we are when clearing server data.
114 enum ClearServerDataState {
115 CLEAR_NOT_STARTED = 1,
116 CLEAR_CLEARING = 2,
117 CLEAR_FAILED = 3,
118 CLEAR_SUCCEEDED = 4,
119 };
120
[email protected]f66bcdf2010-05-17 20:31:14121 // Default sync server URL.
122 static const char* kSyncServerUrl;
123 // Sync server URL for dev channel users
124 static const char* kDevServerUrl;
125
[email protected]e3e43d92010-02-26 22:02:38126 ProfileSyncService(ProfileSyncFactory* factory_,
127 Profile* profile,
[email protected]e8234d32010-09-09 20:36:39128 const std::string& cros_user);
[email protected]132c85652009-08-05 01:18:27129 virtual ~ProfileSyncService();
130
131 // Initializes the object. This should be called every time an object of this
132 // class is constructed.
133 void Initialize();
134
[email protected]e8234d32010-09-09 20:36:39135 void RegisterAuthNotifications();
136
137 // Return whether all sync tokens are loaded and
138 // available for the backend to start up.
139 bool AreCredentialsAvailable();
140
141 // Loads credentials migrated from the old user settings db.
142 void LoadMigratedCredentials(const std::string& username,
143 const std::string& token);
144
[email protected]4aea04a2010-02-10 20:13:43145 // Registers a data type controller with the sync service. This
146 // makes the data type controller available for use, it does not
147 // enable or activate the synchronization of the data type (see
148 // ActivateDataType). Takes ownership of the pointer.
149 void RegisterDataTypeController(
150 browser_sync::DataTypeController* data_type_controller);
151
[email protected]5edb9222010-08-18 00:23:29152 // Returns the session model associator associated with this type, but only if
153 // the associator is running. If it is doing anything else, it will return
154 // null.
155 browser_sync::SessionModelAssociator* GetSessionModelAssociator();
156
[email protected]689a7a72010-09-29 19:56:41157 // Maintain state of where we are in a server clear operation.
158 void ResetClearServerDataState();
159 ClearServerDataState GetClearServerDataState();
160
[email protected]a7ab8332010-03-31 20:49:04161 // Fills state_map with a map of current data types that are possible to
162 // sync, as well as their states.
163 void GetDataTypeControllerStates(
164 browser_sync::DataTypeController::StateMap* state_map) const;
[email protected]4aea04a2010-02-10 20:13:43165
[email protected]e8234d32010-09-09 20:36:39166 // Disables sync for user. Use ShowLoginDialog to enable.
[email protected]132c85652009-08-05 01:18:27167 virtual void DisableForUser();
168
[email protected]1ce52aa2010-09-08 19:07:36169 // Clears all Chromesync data from the server.
170 void ClearServerData();
171
[email protected]132c85652009-08-05 01:18:27172 // Whether sync is enabled by user or not.
[email protected]4772b072010-03-30 17:45:46173 virtual bool HasSyncSetupCompleted() const;
[email protected]48352c12009-08-15 01:19:11174 void SetSyncSetupCompleted();
[email protected]132c85652009-08-05 01:18:27175
[email protected]132c85652009-08-05 01:18:27176 // SyncFrontend implementation.
177 virtual void OnBackendInitialized();
178 virtual void OnSyncCycleCompleted();
179 virtual void OnAuthError();
[email protected]7f8abea2010-07-14 01:31:36180 virtual void OnStopSyncingPermanently();
[email protected]1ce52aa2010-09-08 19:07:36181 virtual void OnClearServerDataFailed();
182 virtual void OnClearServerDataSucceeded();
[email protected]132c85652009-08-05 01:18:27183
184 // Called when a user enters credentials through UI.
185 virtual void OnUserSubmittedAuth(const std::string& username,
[email protected]1fc9b3f2009-11-12 21:22:09186 const std::string& password,
187 const std::string& captcha);
[email protected]132c85652009-08-05 01:18:27188
[email protected]e8234d32010-09-09 20:36:39189 // Update the last auth error and notify observers of error state.
190 void UpdateAuthErrorState(const GoogleServiceAuthError& error);
191
[email protected]af909492010-06-10 18:45:38192 // Called when a user chooses which data types to sync as part of the sync
193 // setup wizard. |sync_everything| represents whether they chose the
[email protected]8c94d632010-06-25 22:38:00194 // "keep everything synced" option; if true, |chosen_types| will be ignored
195 // and all data types will be synced. |sync_everything| means "sync all
196 // current and future data types."
[email protected]af909492010-06-10 18:45:38197 virtual void OnUserChoseDatatypes(bool sync_everything,
[email protected]8c94d632010-06-25 22:38:00198 const syncable::ModelTypeSet& chosen_types);
[email protected]af909492010-06-10 18:45:38199
[email protected]a7ab8332010-03-31 20:49:04200 // Called when a user cancels any setup dialog (login, etc).
[email protected]132c85652009-08-05 01:18:27201 virtual void OnUserCancelledDialog();
202
203 // Get various information for displaying in the user interface.
204 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary();
205 browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus();
206
[email protected]712257e2009-11-11 22:57:46207 const GoogleServiceAuthError& GetAuthError() const {
[email protected]132c85652009-08-05 01:18:27208 return last_auth_error_;
209 }
210
211 // Displays a dialog for the user to enter GAIA credentials and attempt
212 // re-authentication, and returns true if it actually opened the dialog.
213 // Returns false if a dialog is already showing, an auth attempt is in
214 // progress, the sync system is already authenticated, or some error
215 // occurred preventing the action. We make it the duty of ProfileSyncService
216 // to open the dialog to easily ensure only one is ever showing.
[email protected]666ee732010-07-23 23:52:16217 bool SetupInProgress() const;
[email protected]44b78f90a2009-10-15 17:32:20218 bool WizardIsVisible() const {
219 return wizard_.IsVisible();
220 }
[email protected]fbfc2ec2010-07-16 17:00:42221 void ShowLoginDialog(gfx::NativeWindow parent_window);
[email protected]132c85652009-08-05 01:18:27222
[email protected]fbfc2ec2010-07-16 17:00:42223 void ShowChooseDataTypes(gfx::NativeWindow parent_window);
[email protected]8c94d632010-06-25 22:38:00224
[email protected]132c85652009-08-05 01:18:27225 // Pretty-printed strings for a given StatusSummary.
[email protected]066146872010-08-05 00:55:08226 static std::string BuildSyncStatusSummaryText(
[email protected]132c85652009-08-05 01:18:27227 const browser_sync::SyncBackendHost::StatusSummary& summary);
228
229 // Returns true if the SyncBackendHost has told us it's ready to accept
230 // changes.
231 // TODO(timsteele): What happens if the bookmark model is loaded, a change
232 // takes place, and the backend isn't initialized yet?
233 bool sync_initialized() const { return backend_initialized_; }
[email protected]fb42c982009-09-16 22:33:33234 bool unrecoverable_error_detected() const {
235 return unrecoverable_error_detected_;
236 }
[email protected]f6ec8b22010-06-08 23:40:06237 const std::string& unrecoverable_error_message() {
238 return unrecoverable_error_message_;
239 }
240 tracked_objects::Location unrecoverable_error_location() {
241 return unrecoverable_error_location_.get() ?
242 *unrecoverable_error_location_.get() : tracked_objects::Location();
243 }
[email protected]132c85652009-08-05 01:18:27244
245 bool UIShouldDepictAuthInProgress() const {
246 return is_auth_in_progress_;
247 }
248
249 // A timestamp marking the last time the service observed a transition from
250 // the SYNCING state to the READY state. Note that this does not reflect the
251 // last time we polled the server to see if there were any changes; the
252 // timestamp is only snapped when syncing takes place and we download or
253 // upload some bookmark entity.
254 const base::Time& last_synced_time() const { return last_synced_time_; }
255
256 // Returns a user-friendly string form of last synced time (in minutes).
[email protected]066146872010-08-05 00:55:08257 string16 GetLastSyncedTimeString() const;
[email protected]132c85652009-08-05 01:18:27258
259 // Returns the authenticated username of the sync user, or empty if none
260 // exists. It will only exist if the authentication service provider (e.g
261 // GAIA) has confirmed the username is authentic.
262 virtual string16 GetAuthenticatedUsername() const;
263
264 const std::string& last_attempted_user_email() const {
265 return last_attempted_user_email_;
266 }
267
268 // The profile we are syncing for.
269 Profile* profile() { return profile_; }
270
271 // Adds/removes an observer. ProfileSyncService does not take ownership of
272 // the observer.
[email protected]4772b072010-03-30 17:45:46273 virtual void AddObserver(Observer* observer);
274 virtual void RemoveObserver(Observer* observer);
[email protected]132c85652009-08-05 01:18:27275
[email protected]1f97a112009-08-11 02:17:06276 // Record stats on various events.
277 static void SyncEvent(SyncEventCodes code);
278
[email protected]eec3bcfa2009-11-12 17:23:43279 // Returns whether sync is enabled. Sync can be enabled/disabled both
280 // at compile time (e.g., on a per-OS basis) or at run time (e.g.,
281 // command-line switches).
282 static bool IsSyncEnabled();
283
[email protected]d3b98c82010-07-14 07:45:59284 // Retuns whether sync is managed, i.e. controlled by configuration
285 // management. If so, the user is not allowed to configure sync.
286 bool IsManaged();
287
[email protected]db1df0f2009-08-18 22:36:05288 // UnrecoverableErrorHandler implementation.
[email protected]f6ec8b22010-06-08 23:40:06289 virtual void OnUnrecoverableError(
290 const tracked_objects::Location& from_here,
291 const std::string& message);
[email protected]db1df0f2009-08-18 22:36:05292
293 browser_sync::SyncBackendHost* backend() { return backend_.get(); }
294
[email protected]4aea04a2010-02-10 20:13:43295 virtual void ActivateDataType(
296 browser_sync::DataTypeController* data_type_controller,
297 browser_sync::ChangeProcessor* change_processor);
298 virtual void DeactivateDataType(
299 browser_sync::DataTypeController* data_type_controller,
300 browser_sync::ChangeProcessor* change_processor);
301
[email protected]c4c672a2010-03-23 21:47:04302 // NotificationObserver implementation.
303 virtual void Observe(NotificationType type,
304 const NotificationSource& source,
305 const NotificationDetails& details);
306
[email protected]a1c2aef62010-04-02 02:58:05307 // Changes which data types we're going to be syncing to |preferred_types|.
308 // If it is running, the DataTypeManager will be instructed to reconfigure
309 // the sync backend so that exactly these datatypes are actively synced. See
310 // class comment for more on what it means for a datatype to be Preferred.
311 virtual void ChangePreferredDataTypes(
312 const syncable::ModelTypeSet& preferred_types);
313
314 // Get the set of currently enabled data types (as chosen or configured by
315 // the user). See class comment for more on what it means for a datatype
316 // to be Preferred.
317 virtual void GetPreferredDataTypes(
318 syncable::ModelTypeSet* preferred_types) const;
319
320 // Gets the set of all data types that could be allowed (the set that
321 // should be advertised to the user). These will typically only change
322 // via a command-line option. See class comment for more on what it means
323 // for a datatype to be Registered.
324 virtual void GetRegisteredDataTypes(
325 syncable::ModelTypeSet* registered_types) const;
[email protected]a7ab8332010-03-31 20:49:04326
[email protected]ff0aa752010-06-10 22:40:52327 // Checks whether the Cryptographer is ready to encrypt and decrypt updates
328 // for sensitive data types.
329 virtual bool IsCryptographerReady() const;
330
[email protected]bb899b3f2010-06-23 21:35:32331 // Sets the Cryptographer's passphrase. This will check asynchronously whether
332 // the passphrase is valid and notify ProfileSyncServiceObservers via the
333 // NotificationService when the outcome is known.
334 virtual void SetPassphrase(const std::string& passphrase);
335
[email protected]5edb9222010-08-18 00:23:29336 // Returns whether processing changes is allowed. Check this before doing
337 // any model-modifying operations.
338 bool ShouldPushChanges();
339
[email protected]9a127f22010-09-17 21:05:16340 const GURL& sync_service_url() const { return sync_service_url_; }
341
[email protected]132c85652009-08-05 01:18:27342 protected:
[email protected]82d9d2952010-05-15 00:36:16343 // Used by ProfileSyncServiceMock only.
344 //
345 // TODO(akalin): Separate this class out into an abstract
346 // ProfileSyncService interface and a ProfileSyncServiceImpl class
347 // so we don't need this hack anymore.
348 ProfileSyncService();
349
[email protected]7cef1c442010-07-07 17:05:22350 // Helper to install and configure a data type manager.
351 void ConfigureDataTypeManager();
[email protected]132c85652009-08-05 01:18:27352
[email protected]132c85652009-08-05 01:18:27353 // Starts up the backend sync components.
354 void StartUp();
355 // Shuts down the backend sync components.
356 // |sync_disabled| indicates if syncing is being disabled or not.
357 void Shutdown(bool sync_disabled);
358
[email protected]48352c12009-08-15 01:19:11359 // Methods to register and remove preferences.
360 void RegisterPreferences();
361 void ClearPreferences();
362
[email protected]e8234d32010-09-09 20:36:39363 // Return SyncCredentials from the TokenService.
364 sync_api::SyncCredentials GetCredentials();
365
[email protected]18af9a22010-08-11 00:47:19366 // Test need to override this to create backends that allow setting up
367 // initial conditions, such as populating sync nodes.
368 virtual void CreateBackend();
[email protected]132c85652009-08-05 01:18:27369
[email protected]7cef1c442010-07-07 17:05:22370 const browser_sync::DataTypeController::TypeMap& data_type_controllers() {
371 return data_type_controllers_;
372 }
373
[email protected]e8234d32010-09-09 20:36:39374 // The wizard will try to read the auth state out of the profile sync
375 // service using this member. Captcha and error state are reflected.
[email protected]712257e2009-11-11 22:57:46376 GoogleServiceAuthError last_auth_error_;
[email protected]132c85652009-08-05 01:18:27377
[email protected]7cef1c442010-07-07 17:05:22378 // Our asynchronous backend to communicate with sync components living on
379 // other threads.
380 scoped_ptr<browser_sync::SyncBackendHost> backend_;
381
[email protected]132c85652009-08-05 01:18:27382 // Cache of the last name the client attempted to authenticate.
383 std::string last_attempted_user_email_;
384
385 private:
[email protected]132c85652009-08-05 01:18:27386 friend class ProfileSyncServiceTest;
[email protected]4f5732a42010-09-21 22:39:09387 friend class ProfileSyncServicePasswordTest;
[email protected]65b3aa12010-02-22 22:49:00388 friend class ProfileSyncServicePreferenceTest;
[email protected]5edb9222010-08-18 00:23:29389 friend class ProfileSyncServiceSessionTest;
[email protected]626a84f2010-09-25 18:02:54390 friend class ProfileSyncServiceTestHarness;
[email protected]61b694a2010-06-10 10:40:46391 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
392 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest,
393 UnrecoverableErrorSuspendsService);
[email protected]132c85652009-08-05 01:18:27394
[email protected]18af9a22010-08-11 00:47:19395 // If |delete_sync_data_folder| is true, then this method will delete all
396 // previous "Sync Data" folders. (useful if the folder is partial/corrupt).
397 void InitializeBackend(bool delete_sync_data_folder);
398
[email protected]132c85652009-08-05 01:18:27399 // Initializes the various settings from the command line.
400 void InitSettings();
401
[email protected]132c85652009-08-05 01:18:27402 // Sets the last synced time to the current time.
403 void UpdateLastSyncedTime();
404
[email protected]57ecc4b2010-08-11 03:02:51405 static const char* GetPrefNameForDataType(syncable::ModelType data_type);
[email protected]a1c2aef62010-04-02 02:58:05406
[email protected]cb4c06e2009-08-22 00:24:39407 // Time at which we begin an attempt a GAIA authorization.
408 base::TimeTicks auth_start_time_;
409
410 // Time at which error UI is presented for the new tab page.
[email protected]1f97a112009-08-11 02:17:06411 base::TimeTicks auth_error_time_;
412
[email protected]e3e43d92010-02-26 22:02:38413 // Factory used to create various dependent objects.
414 ProfileSyncFactory* factory_;
415
[email protected]132c85652009-08-05 01:18:27416 // The profile whose data we are synchronizing.
417 Profile* profile_;
418
[email protected]e8234d32010-09-09 20:36:39419 // Email for the ChromiumOS user, if we're running under ChromiumOS.
420 std::string cros_user_;
[email protected]72a31b42010-02-17 22:26:33421
[email protected]132c85652009-08-05 01:18:27422 // TODO(ncarter): Put this in a profile, once there is UI for it.
423 // This specifies where to find the sync server.
424 GURL sync_service_url_;
425
[email protected]132c85652009-08-05 01:18:27426 // The last time we detected a successful transition from SYNCING state.
427 // Our backend notifies us whenever we should take a new snapshot.
428 base::Time last_synced_time_;
429
[email protected]4aea04a2010-02-10 20:13:43430 // List of available data type controllers.
[email protected]72a31b42010-02-17 22:26:33431 browser_sync::DataTypeController::TypeMap data_type_controllers_;
[email protected]db1df0f2009-08-18 22:36:05432
[email protected]132c85652009-08-05 01:18:27433 // Whether the SyncBackendHost has been initialized.
434 bool backend_initialized_;
435
[email protected]132c85652009-08-05 01:18:27436 // Various pieces of UI query this value to determine if they should show
437 // an "Authenticating.." type of message. We are the only central place
438 // all auth attempts funnel through, so it makes sense to provide this.
439 // As its name suggests, this should NOT be used for anything other than UI.
440 bool is_auth_in_progress_;
441
[email protected]44b78f90a2009-10-15 17:32:20442 SyncSetupWizard wizard_;
443
[email protected]e8234d32010-09-09 20:36:39444 // Encapsulates user signin with TokenService.
445 SigninManager signin_;
446
[email protected]132c85652009-08-05 01:18:27447 // True if an unrecoverable error (e.g. violation of an assumed invariant)
448 // occurred during syncer operation. This value should be checked before
449 // doing any work that might corrupt things further.
450 bool unrecoverable_error_detected_;
451
[email protected]f6ec8b22010-06-08 23:40:06452 // A message sent when an unrecoverable error occurred.
453 std::string unrecoverable_error_message_;
454 scoped_ptr<tracked_objects::Location> unrecoverable_error_location_;
455
[email protected]33cd0042010-09-08 19:25:28456 // Contains options specific to how sync clients send and listen to
457 // notifications.
458 notifier::NotifierOptions notifier_options_;
[email protected]93d960ce2010-02-11 04:27:00459
[email protected]e3e43d92010-02-26 22:02:38460 // Manages the start and stop of the various data types.
461 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_;
462
[email protected]132c85652009-08-05 01:18:27463 ObserverList<Observer> observers_;
464
[email protected]c4c672a2010-03-23 21:47:04465 NotificationRegistrar registrar_;
466
[email protected]2be7bf22010-04-23 21:02:37467 ScopedRunnableMethodFactory<ProfileSyncService>
468 scoped_runnable_method_factory_;
469
[email protected]d3b98c82010-07-14 07:45:59470 // The preference that controls whether sync is under control by configuration
471 // management.
472 BooleanPrefMember pref_sync_managed_;
473
[email protected]a47eeb52010-07-15 17:54:25474 // This allows us to gracefully handle an ABORTED return code from the
475 // DataTypeManager in the event that the server informed us to cease and
476 // desist syncing immediately.
477 bool expect_sync_configuration_aborted_;
478
[email protected]e8234d32010-09-09 20:36:39479 scoped_ptr<TokenMigrator> token_migrator_;
480
[email protected]48a98b32010-09-17 20:26:59481 // Sometimes we need to temporarily hold on to a passphrase because we don't
482 // yet have a backend to send it to. This happens during initialization as
483 // we don't StartUp until we have a valid token, which happens after valid
484 // credentials were provided.
485 std::string cached_passphrase_;
486
[email protected]689a7a72010-09-29 19:56:41487 // Keep track of where we are in a server clear operation
488 ClearServerDataState clear_server_data_state_;
489
[email protected]132c85652009-08-05 01:18:27490 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
491};
492
493#endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_