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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // JSON anyway. | 71 // JSON anyway. |
72 | 72 |
73 base::DictionaryValue details; | 73 base::DictionaryValue details; |
74 details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); | 74 details.Set("restoredTypes", ModelTypeSetToValue(restored_types)); |
75 | 75 |
76 HandleJsEvent(FROM_HERE, | 76 HandleJsEvent(FROM_HERE, |
77 "onInitializationComplete", | 77 "onInitializationComplete", |
78 JsEventDetails(&details)); | 78 JsEventDetails(&details)); |
79 } | 79 } |
80 | 80 |
81 void JsSyncManagerObserver::OnStopSyncingPermanently() { | |
82 if (!event_handler_.IsInitialized()) { | |
83 return; | |
84 } | |
85 HandleJsEvent(FROM_HERE, "onStopSyncingPermanently", JsEventDetails()); | |
86 } | |
87 | |
88 void JsSyncManagerObserver::HandleJsEvent( | 81 void JsSyncManagerObserver::HandleJsEvent( |
89 const tracked_objects::Location& from_here, | 82 const tracked_objects::Location& from_here, |
90 const std::string& name, const JsEventDetails& details) { | 83 const std::string& name, const JsEventDetails& details) { |
91 if (!event_handler_.IsInitialized()) { | 84 if (!event_handler_.IsInitialized()) { |
92 NOTREACHED(); | 85 NOTREACHED(); |
93 return; | 86 return; |
94 } | 87 } |
95 event_handler_.Call(from_here, | 88 event_handler_.Call(from_here, |
96 &JsEventHandler::HandleJsEvent, name, details); | 89 &JsEventHandler::HandleJsEvent, name, details); |
97 } | 90 } |
98 | 91 |
99 } // namespace syncer | 92 } // namespace syncer |
OLD | NEW |