| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/js/js_sync_manager_observer.h" | 5 #include "chrome/browser/sync/js/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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 HandleJsEvent(FROM_HERE, "onClearServerDataSucceeded", JsEventDetails()); | 127 HandleJsEvent(FROM_HERE, "onClearServerDataSucceeded", JsEventDetails()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void JsSyncManagerObserver::OnClearServerDataFailed() { | 130 void JsSyncManagerObserver::OnClearServerDataFailed() { |
| 131 if (!event_handler_.IsInitialized()) { | 131 if (!event_handler_.IsInitialized()) { |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 HandleJsEvent(FROM_HERE, "onClearServerDataFailed", JsEventDetails()); | 134 HandleJsEvent(FROM_HERE, "onClearServerDataFailed", JsEventDetails()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void JsSyncManagerObserver::OnUnrecoverableError( |
| 138 const tracked_objects::Location& location, |
| 139 const std::string& message) { |
| 140 if (!event_handler_.IsInitialized()) { |
| 141 return; |
| 142 } |
| 143 DictionaryValue details; |
| 144 details.SetString("location", location.ToString()); |
| 145 details.SetString("message", message); |
| 146 HandleJsEvent(FROM_HERE, "onUnrecoverableError", JsEventDetails(&details)); |
| 147 } |
| 148 |
| 149 |
| 137 void JsSyncManagerObserver::HandleJsEvent( | 150 void JsSyncManagerObserver::HandleJsEvent( |
| 138 const tracked_objects::Location& from_here, | 151 const tracked_objects::Location& from_here, |
| 139 const std::string& name, const JsEventDetails& details) { | 152 const std::string& name, const JsEventDetails& details) { |
| 140 if (!event_handler_.IsInitialized()) { | 153 if (!event_handler_.IsInitialized()) { |
| 141 NOTREACHED(); | 154 NOTREACHED(); |
| 142 return; | 155 return; |
| 143 } | 156 } |
| 144 event_handler_.Call(from_here, | 157 event_handler_.Call(from_here, |
| 145 &JsEventHandler::HandleJsEvent, name, details); | 158 &JsEventHandler::HandleJsEvent, name, details); |
| 146 } | 159 } |
| 147 | 160 |
| 148 } // namespace browser_sync | 161 } // namespace browser_sync |
| OLD | NEW |