diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 04:37:48 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 04:37:48 +0000 |
commit | 62c28b9b77bb585b190ec8afaef43d5bcb764c79 (patch) | |
tree | 0081e6a5f3f5c3822929355cf6ef41b955c78d9b /sync/internal_api/js_sync_manager_observer.cc | |
parent | e841d0622eb6119d407d4acf4eeb6402c7c49ea8 (diff) | |
download | chromium_src-62c28b9b77bb585b190ec8afaef43d5bcb764c79.zip chromium_src-62c28b9b77bb585b190ec8afaef43d5bcb764c79.tar.gz chromium_src-62c28b9b77bb585b190ec8afaef43d5bcb764c79.tar.bz2 |
Make SyncBackendRegistrar aware of loaded data
Adds a parameter to the SyncManager::Initialize() callback to inform the
caller which sync data types were successfully loaded from disk. This
allows the SyncBackendHost and related classes make better decisions
during initialization.
If necessary, the SyncBackendHost will send a configure request to the
syncer during early initialization asking it to download the nigori
node. Now we can guarantee that the node will be available by the type
ProfileSyncService::OnBackendInitialized() is called.
The SyncBackendHost test expectations had to be amended to account for
this test. Most of the changes are related to the fact that our
behaviour no longer depends on the SyncPrefs.
The ProfileSyncService*Tests were very much affected by this change.
Those tests are parameterized with a callback that is used to initialize
the sync DB and pretend that it had been loaded from disk. Previously,
this callback would be executed later on during initialization, around
the time of ProfileSyncService::OnBackendInitialize(). That approach was
incompatible with this change, which requires that we have access to the
fully initialized database around the time we return from
SyncBackendHost::Initialize(). The callback had to be moved, which meant
that it now required an explicit UserShare parameter, which meant that a
lot of call sites had to be updated.
BUG=129825
TEST=
Review URL: https://chromiumcodereview.appspot.com/10804039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/js_sync_manager_observer.cc')
-rw-r--r-- | sync/internal_api/js_sync_manager_observer.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sync/internal_api/js_sync_manager_observer.cc b/sync/internal_api/js_sync_manager_observer.cc index 5eda7f1..078e1e9 100644 --- a/sync/internal_api/js_sync_manager_observer.cc +++ b/sync/internal_api/js_sync_manager_observer.cc @@ -124,13 +124,17 @@ void JsSyncManagerObserver::OnActionableError( void JsSyncManagerObserver::OnInitializationComplete( const WeakHandle<JsBackend>& js_backend, - bool success) { + bool success, syncer::ModelTypeSet restored_types) { if (!event_handler_.IsInitialized()) { return; } // Ignore the |js_backend| argument; it's not really convertible to // JSON anyway. - HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails()); + + DictionaryValue* details = new DictionaryValue(); + details->Set("restoredTypes", ModelTypeSetToValue(restored_types)); + + HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails(details)); } void JsSyncManagerObserver::OnStopSyncingPermanently() { |