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

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

Issue 10804039: Make SyncBackendRegistrar aware of loaded data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better comments 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 25 matching lines...) Expand all
36 namespace syncer { 36 namespace syncer {
37 class SyncManagerFactory; 37 class SyncManagerFactory;
38 } 38 }
39 39
40 namespace browser_sync { 40 namespace browser_sync {
41 41
42 class ChangeProcessor; 42 class ChangeProcessor;
43 class ChromeSyncNotificationBridge; 43 class ChromeSyncNotificationBridge;
44 struct Experiments; 44 struct Experiments;
45 class InvalidatorStorage; 45 class InvalidatorStorage;
46 class JsBackend;
47 class JsEventHandler;
48 class SyncBackendRegistrar; 46 class SyncBackendRegistrar;
49 class SyncPrefs; 47 class SyncPrefs;
50 48
51 // SyncFrontend is the interface used by SyncBackendHost to communicate with 49 // SyncFrontend is the interface used by SyncBackendHost to communicate with
52 // the entity that created it and, presumably, is interested in sync-related 50 // the entity that created it and, presumably, is interested in sync-related
53 // activity. 51 // activity.
54 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread 52 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread
55 // used to create that SyncBackendHost. 53 // used to create that SyncBackendHost.
56 class SyncFrontend { 54 class SyncFrontend {
57 public: 55 public:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Called on |frontend_loop_| to kick off asynchronous initialization. 161 // Called on |frontend_loop_| to kick off asynchronous initialization.
164 // As a fallback when no cached auth information is available, try to 162 // As a fallback when no cached auth information is available, try to
165 // bootstrap authentication using |lsid|, if it isn't empty. 163 // bootstrap authentication using |lsid|, if it isn't empty.
166 // Optionally delete the Sync Data folder (if it's corrupt). 164 // Optionally delete the Sync Data folder (if it's corrupt).
167 // |report_unrecoverable_error_function| can be NULL. 165 // |report_unrecoverable_error_function| can be NULL.
168 // Note: |unrecoverable_error_handler| may be invoked from any thread. 166 // Note: |unrecoverable_error_handler| may be invoked from any thread.
169 void Initialize( 167 void Initialize(
170 SyncFrontend* frontend, 168 SyncFrontend* frontend,
171 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 169 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
172 const GURL& service_url, 170 const GURL& service_url,
173 syncer::ModelTypeSet initial_types,
174 const syncer::SyncCredentials& credentials, 171 const syncer::SyncCredentials& credentials,
175 bool delete_sync_data_folder, 172 bool delete_sync_data_folder,
176 syncer::SyncManagerFactory* sync_manager_factory, 173 syncer::SyncManagerFactory* sync_manager_factory,
177 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 174 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
178 syncer::ReportUnrecoverableErrorFunction 175 syncer::ReportUnrecoverableErrorFunction
179 report_unrecoverable_error_function); 176 report_unrecoverable_error_function);
180 177
181 // Called from |frontend_loop| to update SyncCredentials. 178 // Called from |frontend_loop| to update SyncCredentials.
182 void UpdateCredentials(const syncer::SyncCredentials& credentials); 179 void UpdateCredentials(const syncer::SyncCredentials& credentials);
183 180
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 syncer::ModelType type, syncer::ModelSafeGroup group, 240 syncer::ModelType type, syncer::ModelSafeGroup group,
244 ChangeProcessor* change_processor); 241 ChangeProcessor* change_processor);
245 242
246 // Deactivates change processing for the given data type. 243 // Deactivates change processing for the given data type.
247 void DeactivateDataType(syncer::ModelType type); 244 void DeactivateDataType(syncer::ModelType type);
248 245
249 // Called on |frontend_loop_| to obtain a handle to the UserShare needed 246 // Called on |frontend_loop_| to obtain a handle to the UserShare needed
250 // for creating transactions. 247 // for creating transactions.
251 syncer::UserShare* GetUserShare() const; 248 syncer::UserShare* GetUserShare() const;
252 249
250 // Same as the above function, but bypasses a few sanity checks.
251 syncer::UserShare* GetUserShareForTest() const;
252
253 // 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
254 // summarized form. 254 // summarized form.
255 Status GetDetailedStatus(); 255 Status GetDetailedStatus();
256 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const; 256 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const;
257 257
258 // Determines if the underlying sync engine has made any local changes to 258 // Determines if the underlying sync engine has made any local changes to
259 // items that have not yet been synced with the server. 259 // items that have not yet been synced with the server.
260 // ONLY CALL THIS IF OnInitializationComplete was called! 260 // ONLY CALL THIS IF OnInitializationComplete was called!
261 bool HasUnsyncedItems() const; 261 bool HasUnsyncedItems() const;
262 262
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 const syncer::ModelSafeRoutingInfo& routing_info, 338 const syncer::ModelSafeRoutingInfo& routing_info,
339 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, 339 const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
340 const base::Closure& retry_callback); 340 const base::Closure& retry_callback);
341 341
342 // Called when the syncer has finished performing a configuration. 342 // Called when the syncer has finished performing a configuration.
343 void FinishConfigureDataTypesOnFrontendLoop( 343 void FinishConfigureDataTypesOnFrontendLoop(
344 const syncer::ModelTypeSet types_to_configure, 344 const syncer::ModelTypeSet types_to_configure,
345 const syncer::ModelTypeSet configured_types, 345 const syncer::ModelTypeSet configured_types,
346 const base::Callback<void(syncer::ModelTypeSet)>& ready_task); 346 const base::Callback<void(syncer::ModelTypeSet)>& ready_task);
347 347
348 // Called when the SyncManager has been constructed and initialized.
349 virtual void HandleSyncManagerInitializationOnFrontendLoop(
350 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success,
351 syncer::ModelTypeSet restored_types);
352
348 private: 353 private:
349 // The real guts of SyncBackendHost, to keep the public client API clean. 354 // The real guts of SyncBackendHost, to keep the public client API clean.
350 class Core; 355 class Core;
351 356
352 // An enum representing the steps to initializing the SyncBackendHost. 357 // An enum representing the steps to initializing the SyncBackendHost.
353 enum InitializationState { 358 enum InitializationState {
354 NOT_ATTEMPTED, 359 NOT_ATTEMPTED,
355 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the 360 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the
356 // sync thread to inform us that the sync manager 361 // sync thread to inform us that the sync manager
357 // has been created. 362 // has been created.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 507
503 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. 508 // UI-thread cache of the last SyncSessionSnapshot received from syncapi.
504 syncer::sessions::SyncSessionSnapshot last_snapshot_; 509 syncer::sessions::SyncSessionSnapshot last_snapshot_;
505 510
506 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 511 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
507 }; 512 };
508 513
509 } // namespace browser_sync 514 } // namespace browser_sync
510 515
511 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 516 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698