| 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 "components/sync/core_impl/js_sync_manager_observer.h" | 5 #include "components/sync/core_impl/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void JsSyncManagerObserver::OnProtocolEvent(const ProtocolEvent& event) {} | 61 void JsSyncManagerObserver::OnProtocolEvent(const ProtocolEvent& event) {} |
| 62 | 62 |
| 63 void JsSyncManagerObserver::OnMigrationRequested(ModelTypeSet types) {} | 63 void JsSyncManagerObserver::OnMigrationRequested(ModelTypeSet types) {} |
| 64 | 64 |
| 65 void JsSyncManagerObserver::OnInitializationComplete( | 65 void JsSyncManagerObserver::OnInitializationComplete( |
| 66 const WeakHandle<JsBackend>& js_backend, | 66 const WeakHandle<JsBackend>& js_backend, |
| 67 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | 67 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
| 68 bool success, | 68 bool success, |
| 69 ModelTypeSet restored_types) { | 69 syncer::ModelTypeSet restored_types) { |
| 70 if (!event_handler_.IsInitialized()) { | 70 if (!event_handler_.IsInitialized()) { |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 // Ignore the |js_backend| argument; it's not really convertible to | 73 // Ignore the |js_backend| argument; it's not really convertible to |
| 74 // JSON anyway. | 74 // JSON anyway. |
| 75 | 75 |
| 76 base::DictionaryValue details; | 76 base::DictionaryValue details; |
| 77 details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); | 77 details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); |
| 78 | 78 |
| 79 HandleJsEvent(FROM_HERE, "onInitializationComplete", | 79 HandleJsEvent(FROM_HERE, "onInitializationComplete", |
| 80 JsEventDetails(&details)); | 80 JsEventDetails(&details)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void JsSyncManagerObserver::HandleJsEvent( | 83 void JsSyncManagerObserver::HandleJsEvent( |
| 84 const tracked_objects::Location& from_here, | 84 const tracked_objects::Location& from_here, |
| 85 const std::string& name, | 85 const std::string& name, |
| 86 const JsEventDetails& details) { | 86 const JsEventDetails& details) { |
| 87 if (!event_handler_.IsInitialized()) { | 87 if (!event_handler_.IsInitialized()) { |
| 88 NOTREACHED(); | 88 NOTREACHED(); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 event_handler_.Call(from_here, &JsEventHandler::HandleJsEvent, name, details); | 91 event_handler_.Call(from_here, &JsEventHandler::HandleJsEvent, name, details); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace syncer | 94 } // namespace syncer |
| OLD | NEW |