OLD | NEW |
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return; | 118 return; |
119 } | 119 } |
120 DictionaryValue details; | 120 DictionaryValue details; |
121 details.Set("syncError", sync_error.ToValue()); | 121 details.Set("syncError", sync_error.ToValue()); |
122 HandleJsEvent(FROM_HERE, "onActionableError", | 122 HandleJsEvent(FROM_HERE, "onActionableError", |
123 JsEventDetails(&details)); | 123 JsEventDetails(&details)); |
124 } | 124 } |
125 | 125 |
126 void JsSyncManagerObserver::OnInitializationComplete( | 126 void JsSyncManagerObserver::OnInitializationComplete( |
127 const WeakHandle<JsBackend>& js_backend, | 127 const WeakHandle<JsBackend>& js_backend, |
128 bool success) { | 128 bool success, syncable::ModelTypeSet restored_types) { |
129 if (!event_handler_.IsInitialized()) { | 129 if (!event_handler_.IsInitialized()) { |
130 return; | 130 return; |
131 } | 131 } |
132 // Ignore the |js_backend| argument; it's not really convertible to | 132 // Ignore the |js_backend| argument; it's not really convertible to |
133 // JSON anyway. | 133 // JSON anyway. |
134 HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails()); | 134 |
| 135 DictionaryValue *details = new DictionaryValue(); |
| 136 details->Set("restoredTypes", ModelTypeSetToValue(restored_types)); |
| 137 |
| 138 HandleJsEvent(FROM_HERE, "onInitializationComplete", JsEventDetails(details)); |
135 } | 139 } |
136 | 140 |
137 void JsSyncManagerObserver::OnStopSyncingPermanently() { | 141 void JsSyncManagerObserver::OnStopSyncingPermanently() { |
138 if (!event_handler_.IsInitialized()) { | 142 if (!event_handler_.IsInitialized()) { |
139 return; | 143 return; |
140 } | 144 } |
141 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails()); | 145 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails()); |
142 } | 146 } |
143 | 147 |
144 void JsSyncManagerObserver::OnClearServerDataSucceeded() { | 148 void JsSyncManagerObserver::OnClearServerDataSucceeded() { |
(...skipping 15 matching lines...) Expand all Loading... |
160 const std::string& name, const JsEventDetails& details) { | 164 const std::string& name, const JsEventDetails& details) { |
161 if (!event_handler_.IsInitialized()) { | 165 if (!event_handler_.IsInitialized()) { |
162 NOTREACHED(); | 166 NOTREACHED(); |
163 return; | 167 return; |
164 } | 168 } |
165 event_handler_.Call(from_here, | 169 event_handler_.Call(from_here, |
166 &JsEventHandler::HandleJsEvent, name, details); | 170 &JsEventHandler::HandleJsEvent, name, details); |
167 } | 171 } |
168 | 172 |
169 } // namespace browser_sync | 173 } // namespace browser_sync |
OLD | NEW |