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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.h

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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 (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_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // below). 101 // below).
102 // 102 //
103 // |encrypted_types| will always be a superset of 103 // |encrypted_types| will always be a superset of
104 // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is 104 // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is
105 // true, |encrypted_types| will be the set of all known types. 105 // true, |encrypted_types| will be the set of all known types.
106 // 106 //
107 // Until this function is called, observers can assume that the set 107 // Until this function is called, observers can assume that the set
108 // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that 108 // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that
109 // the encrypt everything flag is false. 109 // the encrypt everything flag is false.
110 virtual void OnEncryptedTypesChanged( 110 virtual void OnEncryptedTypesChanged(
111 syncable::ModelTypeSet encrypted_types, 111 syncer::ModelTypeSet encrypted_types,
112 bool encrypt_everything) = 0; 112 bool encrypt_everything) = 0;
113 113
114 // Called after we finish encrypting the current set of encrypted 114 // Called after we finish encrypting the current set of encrypted
115 // types. 115 // types.
116 virtual void OnEncryptionComplete() = 0; 116 virtual void OnEncryptionComplete() = 0;
117 117
118 // Called to perform migration of |types|. 118 // Called to perform migration of |types|.
119 virtual void OnMigrationNeededForTypes( 119 virtual void OnMigrationNeededForTypes(syncer::ModelTypeSet types) = 0;
120 syncable::ModelTypeSet types) = 0;
121 120
122 // Inform the Frontend that new datatypes are available for registration. 121 // Inform the Frontend that new datatypes are available for registration.
123 virtual void OnExperimentsChanged( 122 virtual void OnExperimentsChanged(
124 const syncer::Experiments& experiments) = 0; 123 const syncer::Experiments& experiments) = 0;
125 124
126 // Called when the sync cycle returns there is an user actionable error. 125 // Called when the sync cycle returns there is an user actionable error.
127 virtual void OnActionableError( 126 virtual void OnActionableError(const syncer::SyncProtocolError& error) = 0;
128 const syncer::SyncProtocolError& error) = 0;
129 127
130 protected: 128 protected:
131 // Don't delete through SyncFrontend interface. 129 // Don't delete through SyncFrontend interface.
132 virtual ~SyncFrontend() { 130 virtual ~SyncFrontend() {
133 } 131 }
134 private: 132 private:
135 DISALLOW_COPY_AND_ASSIGN(SyncFrontend); 133 DISALLOW_COPY_AND_ASSIGN(SyncFrontend);
136 }; 134 };
137 135
138 // A UI-thread safe API into the sync backend that "hosts" the top-level 136 // A UI-thread safe API into the sync backend that "hosts" the top-level
(...skipping 23 matching lines...) Expand all
162 // Called on |frontend_loop_| to kick off asynchronous initialization. 160 // Called on |frontend_loop_| to kick off asynchronous initialization.
163 // As a fallback when no cached auth information is available, try to 161 // As a fallback when no cached auth information is available, try to
164 // bootstrap authentication using |lsid|, if it isn't empty. 162 // bootstrap authentication using |lsid|, if it isn't empty.
165 // Optionally delete the Sync Data folder (if it's corrupt). 163 // Optionally delete the Sync Data folder (if it's corrupt).
166 // |report_unrecoverable_error_function| can be NULL. 164 // |report_unrecoverable_error_function| can be NULL.
167 // Note: |unrecoverable_error_handler| may be invoked from any thread. 165 // Note: |unrecoverable_error_handler| may be invoked from any thread.
168 void Initialize( 166 void Initialize(
169 SyncFrontend* frontend, 167 SyncFrontend* frontend,
170 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 168 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
171 const GURL& service_url, 169 const GURL& service_url,
172 syncable::ModelTypeSet initial_types, 170 syncer::ModelTypeSet initial_types,
173 const syncer::SyncCredentials& credentials, 171 const syncer::SyncCredentials& credentials,
174 bool delete_sync_data_folder, 172 bool delete_sync_data_folder,
175 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 173 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
176 syncer::ReportUnrecoverableErrorFunction 174 syncer::ReportUnrecoverableErrorFunction
177 report_unrecoverable_error_function); 175 report_unrecoverable_error_function);
178 176
179 // Called from |frontend_loop| to update SyncCredentials. 177 // Called from |frontend_loop| to update SyncCredentials.
180 void UpdateCredentials(const syncer::SyncCredentials& credentials); 178 void UpdateCredentials(const syncer::SyncCredentials& credentials);
181 179
182 // This starts the SyncerThread running a Syncer object to communicate with 180 // This starts the SyncerThread running a Syncer object to communicate with
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // See the implementation and Core::DoShutdown for details. 215 // See the implementation and Core::DoShutdown for details.
218 // Must be called *after* StopSyncingForShutdown. 216 // Must be called *after* StopSyncingForShutdown.
219 void Shutdown(bool sync_disabled); 217 void Shutdown(bool sync_disabled);
220 218
221 // Changes the set of data types that are currently being synced. 219 // Changes the set of data types that are currently being synced.
222 // The ready_task will be run when configuration is done with the 220 // The ready_task will be run when configuration is done with the
223 // set of all types that failed configuration (i.e., if its argument 221 // set of all types that failed configuration (i.e., if its argument
224 // is non-empty, then an error was encountered). 222 // is non-empty, then an error was encountered).
225 virtual void ConfigureDataTypes( 223 virtual void ConfigureDataTypes(
226 syncer::ConfigureReason reason, 224 syncer::ConfigureReason reason,
227 syncable::ModelTypeSet types_to_add, 225 syncer::ModelTypeSet types_to_add,
228 syncable::ModelTypeSet types_to_remove, 226 syncer::ModelTypeSet types_to_remove,
229 NigoriState nigori_state, 227 NigoriState nigori_state,
230 base::Callback<void(syncable::ModelTypeSet)> ready_task, 228 base::Callback<void(syncer::ModelTypeSet)> ready_task,
231 base::Callback<void()> retry_callback) OVERRIDE; 229 base::Callback<void()> retry_callback) OVERRIDE;
232 230
233 // Makes an asynchronous call to syncer to switch to config mode. When done 231 // Makes an asynchronous call to syncer to switch to config mode. When done
234 // syncer will call us back on FinishConfigureDataTypes. 232 // syncer will call us back on FinishConfigureDataTypes.
235 virtual void StartConfiguration(const base::Closure& callback); 233 virtual void StartConfiguration(const base::Closure& callback);
236 234
237 // Turns on encryption of all present and future sync data. 235 // Turns on encryption of all present and future sync data.
238 virtual void EnableEncryptEverything(); 236 virtual void EnableEncryptEverything();
239 237
240 // Activates change processing for the given data type. This must 238 // Activates change processing for the given data type. This must
241 // be called synchronously with the data type's model association so 239 // be called synchronously with the data type's model association so
242 // no changes are dropped between model association and change 240 // no changes are dropped between model association and change
243 // processor activation. 241 // processor activation.
244 void ActivateDataType( 242 void ActivateDataType(
245 syncable::ModelType type, syncer::ModelSafeGroup group, 243 syncer::ModelType type, syncer::ModelSafeGroup group,
246 ChangeProcessor* change_processor); 244 ChangeProcessor* change_processor);
247 245
248 // Deactivates change processing for the given data type. 246 // Deactivates change processing for the given data type.
249 void DeactivateDataType(syncable::ModelType type); 247 void DeactivateDataType(syncer::ModelType type);
250 248
251 // Called on |frontend_loop_| to obtain a handle to the UserShare needed 249 // Called on |frontend_loop_| to obtain a handle to the UserShare needed
252 // for creating transactions. 250 // for creating transactions.
253 syncer::UserShare* GetUserShare() const; 251 syncer::UserShare* GetUserShare() const;
254 252
255 // Called from any thread to obtain current status information in detailed or 253 // Called from any thread to obtain current status information in detailed or
256 // summarized form. 254 // summarized form.
257 Status GetDetailedStatus(); 255 Status GetDetailedStatus();
258 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const; 256 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const;
259 257
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 bool delete_sync_data_folder, 299 bool delete_sync_data_folder,
302 const std::string& restored_key_for_bootstrapping, 300 const std::string& restored_key_for_bootstrapping,
303 syncer::SyncManager::TestingMode testing_mode, 301 syncer::SyncManager::TestingMode testing_mode,
304 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 302 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
305 syncer::ReportUnrecoverableErrorFunction 303 syncer::ReportUnrecoverableErrorFunction
306 report_unrecoverable_error_function); 304 report_unrecoverable_error_function);
307 ~DoInitializeOptions(); 305 ~DoInitializeOptions();
308 306
309 MessageLoop* sync_loop; 307 MessageLoop* sync_loop;
310 SyncBackendRegistrar* registrar; 308 SyncBackendRegistrar* registrar;
311 syncer::ModelSafeRoutingInfo routing_info; 309 syncer::ModelSafeRoutingInfo routing_info;
312 std::vector<syncer::ModelSafeWorker*> workers; 310 std::vector<syncer::ModelSafeWorker*> workers;
313 syncer::ExtensionsActivityMonitor* extensions_activity_monitor; 311 syncer::ExtensionsActivityMonitor* extensions_activity_monitor;
314 syncer::WeakHandle<syncer::JsEventHandler> event_handler; 312 syncer::WeakHandle<syncer::JsEventHandler> event_handler;
315 GURL service_url; 313 GURL service_url;
316 // Overridden by tests. 314 // Overridden by tests.
317 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn; 315 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn;
318 syncer::SyncCredentials credentials; 316 syncer::SyncCredentials credentials;
319 ChromeSyncNotificationBridge* const chrome_sync_notification_bridge; 317 ChromeSyncNotificationBridge* const chrome_sync_notification_bridge;
320 syncer::SyncNotifierFactory* const sync_notifier_factory; 318 syncer::SyncNotifierFactory* const sync_notifier_factory;
321 std::string lsid; 319 std::string lsid;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 INITIALIZED, // Initialization is complete. 360 INITIALIZED, // Initialization is complete.
363 }; 361 };
364 362
365 struct PendingConfigureDataTypesState { 363 struct PendingConfigureDataTypesState {
366 PendingConfigureDataTypesState(); 364 PendingConfigureDataTypesState();
367 ~PendingConfigureDataTypesState(); 365 ~PendingConfigureDataTypesState();
368 366
369 // The ready_task will be run when configuration is done with the 367 // The ready_task will be run when configuration is done with the
370 // set of all types that failed configuration (i.e., if its 368 // set of all types that failed configuration (i.e., if its
371 // argument is non-empty, then an error was encountered). 369 // argument is non-empty, then an error was encountered).
372 base::Callback<void(syncable::ModelTypeSet)> ready_task; 370 base::Callback<void(syncer::ModelTypeSet)> ready_task;
373 371
374 // The retry callback will be run when the download failed due to a 372 // The retry callback will be run when the download failed due to a
375 // transient error. This is to notify DTM so it can apropriately inform 373 // transient error. This is to notify DTM so it can apropriately inform
376 // the UI. Note: The retry_callback will be run only once and after 374 // the UI. Note: The retry_callback will be run only once and after
377 // that we will not notify DTM until the sync is successful or in a 375 // that we will not notify DTM until the sync is successful or in a
378 // permanent error state. 376 // permanent error state.
379 base::Callback<void()> retry_callback; 377 base::Callback<void()> retry_callback;
380 378
381 // The set of types that we are waiting to be initially synced in a 379 // The set of types that we are waiting to be initially synced in a
382 // configuration cycle. 380 // configuration cycle.
383 syncable::ModelTypeSet types_to_add; 381 syncer::ModelTypeSet types_to_add;
384 382
385 // Additional details about which types were added. 383 // Additional details about which types were added.
386 syncable::ModelTypeSet added_types; 384 syncer::ModelTypeSet added_types;
387 syncer::ConfigureReason reason; 385 syncer::ConfigureReason reason;
388 bool retry_in_progress; 386 bool retry_in_progress;
389 }; 387 };
390 388
391 // Checks if we have received a notice to turn on experimental datatypes 389 // Checks if we have received a notice to turn on experimental datatypes
392 // (via the nigori node) and informs the frontend if that is the case. 390 // (via the nigori node) and informs the frontend if that is the case.
393 // Note: it is illegal to call this before the backend is initialized. 391 // Note: it is illegal to call this before the backend is initialized.
394 void AddExperimentalTypes(); 392 void AddExperimentalTypes();
395 393
396 // Downloading of nigori failed and will be retried. 394 // Downloading of nigori failed and will be retried.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 432
435 // Invoked when the passphrase provided by the user has been accepted. 433 // Invoked when the passphrase provided by the user has been accepted.
436 void NotifyPassphraseAccepted(); 434 void NotifyPassphraseAccepted();
437 435
438 // Invoked when an updated token is available from the sync server. 436 // Invoked when an updated token is available from the sync server.
439 void NotifyUpdatedToken(const std::string& token); 437 void NotifyUpdatedToken(const std::string& token);
440 438
441 // Invoked when the set of encrypted types or the encrypt 439 // Invoked when the set of encrypted types or the encrypt
442 // everything flag changes. 440 // everything flag changes.
443 void NotifyEncryptedTypesChanged( 441 void NotifyEncryptedTypesChanged(
444 syncable::ModelTypeSet encrypted_types, 442 syncer::ModelTypeSet encrypted_types,
445 bool encrypt_everything); 443 bool encrypt_everything);
446 444
447 // Invoked when sync finishes encrypting new datatypes. 445 // Invoked when sync finishes encrypting new datatypes.
448 void NotifyEncryptionComplete(); 446 void NotifyEncryptionComplete();
449 447
450 void HandleStopSyncingPermanentlyOnFrontendLoop(); 448 void HandleStopSyncingPermanentlyOnFrontendLoop();
451 449
452 // Dispatched to from OnConnectionStatusChange to handle updating 450 // Dispatched to from OnConnectionStatusChange to handle updating
453 // frontend UI components. 451 // frontend UI components.
454 void HandleConnectionStatusChangeOnFrontendLoop( 452 void HandleConnectionStatusChangeOnFrontendLoop(
455 syncer::ConnectionStatus status); 453 syncer::ConnectionStatus status);
456 454
457 // Called when configuration of the Nigori node has completed as 455 // Called when configuration of the Nigori node has completed as
458 // part of the initialization process. 456 // part of the initialization process.
459 void HandleNigoriConfigurationCompletedOnFrontendLoop( 457 void HandleNigoriConfigurationCompletedOnFrontendLoop(
460 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 458 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
461 syncable::ModelTypeSet failed_configuration_types); 459 syncer::ModelTypeSet failed_configuration_types);
462 460
463 // Must be called on |frontend_loop_|. |done_callback| is called on 461 // Must be called on |frontend_loop_|. |done_callback| is called on
464 // |frontend_loop_|. 462 // |frontend_loop_|.
465 void RefreshNigori(const base::Closure& done_callback); 463 void RefreshNigori(const base::Closure& done_callback);
466 464
467 // Handles stopping the core's SyncManager, accounting for whether 465 // Handles stopping the core's SyncManager, accounting for whether
468 // initialization is done yet. 466 // initialization is done yet.
469 void StopSyncManagerForShutdown(const base::Closure& closure); 467 void StopSyncManagerForShutdown(const base::Closure& closure);
470 468
471 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; 469 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 515
518 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. 516 // UI-thread cache of the last SyncSessionSnapshot received from syncapi.
519 syncer::sessions::SyncSessionSnapshot last_snapshot_; 517 syncer::sessions::SyncSessionSnapshot last_snapshot_;
520 518
521 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 519 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
522 }; 520 };
523 521
524 } // namespace browser_sync 522 } // namespace browser_sync
525 523
526 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 524 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/shared_change_processor_unittest.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698