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

Side by Side Diff: sync/internal_api/js_sync_manager_observer.cc

Issue 10804039: Make SyncBackendRegistrar aware of loaded data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 #include "sync/internal_api/js_sync_manager_observer.h" 5 #include "sync/internal_api/js_sync_manager_observer.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return; 117 return;
118 } 118 }
119 DictionaryValue details; 119 DictionaryValue details;
120 details.Set("syncError", sync_error.ToValue()); 120 details.Set("syncError", sync_error.ToValue());
121 HandleJsEvent(FROM_HERE, "onActionableError", 121 HandleJsEvent(FROM_HERE, "onActionableError",
122 JsEventDetails(&details)); 122 JsEventDetails(&details));
123 } 123 }
124 124
125 void JsSyncManagerObserver::OnInitializationComplete( 125 void JsSyncManagerObserver::OnInitializationComplete(
126 const WeakHandle<JsBackend>& js_backend, 126 const WeakHandle<JsBackend>& js_backend,
127 bool success) { 127 bool success, syncer::ModelTypeSet restored_types) {
128 if (!event_handler_.IsInitialized()) { 128 if (!event_handler_.IsInitialized()) {
129 return; 129 return;
130 } 130 }
131 // Ignore the |js_backend| argument; it's not really convertible to 131 // Ignore the |js_backend| argument; it's not really convertible to
132 // JSON anyway. 132 // JSON anyway.
133 HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails()); 133
134 DictionaryValue* details = new DictionaryValue();
135 details->Set("restoredTypes", ModelTypeSetToValue(restored_types));
136
137 HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails(details));
134 } 138 }
135 139
136 void JsSyncManagerObserver::OnStopSyncingPermanently() { 140 void JsSyncManagerObserver::OnStopSyncingPermanently() {
137 if (!event_handler_.IsInitialized()) { 141 if (!event_handler_.IsInitialized()) {
138 return; 142 return;
139 } 143 }
140 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails()); 144 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails());
141 } 145 }
142 146
143 void JsSyncManagerObserver::HandleJsEvent( 147 void JsSyncManagerObserver::HandleJsEvent(
144 const tracked_objects::Location& from_here, 148 const tracked_objects::Location& from_here,
145 const std::string& name, const JsEventDetails& details) { 149 const std::string& name, const JsEventDetails& details) {
146 if (!event_handler_.IsInitialized()) { 150 if (!event_handler_.IsInitialized()) {
147 NOTREACHED(); 151 NOTREACHED();
148 return; 152 return;
149 } 153 }
150 event_handler_.Call(from_here, 154 event_handler_.Call(from_here,
151 &JsEventHandler::HandleJsEvent, name, details); 155 &JsEventHandler::HandleJsEvent, name, details);
152 } 156 }
153 157
154 } // namespace syncer 158 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/js_sync_manager_observer.h ('k') | sync/internal_api/js_sync_manager_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698