| 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/engine_impl/js_mutation_event_observer.h" | 5 #include "components/sync/engine_impl/js_mutation_event_observer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const size_t changes_size = changes.Get().size(); | 57 const size_t changes_size = changes.Get().size(); |
| 58 if (changes_size <= kChangeLimit) { | 58 if (changes_size <= kChangeLimit) { |
| 59 base::ListValue* changes_list = new base::ListValue(); | 59 base::ListValue* changes_list = new base::ListValue(); |
| 60 for (ChangeRecordList::const_iterator it = changes.Get().begin(); | 60 for (ChangeRecordList::const_iterator it = changes.Get().begin(); |
| 61 it != changes.Get().end(); ++it) { | 61 it != changes.Get().end(); ++it) { |
| 62 changes_list->Append(it->ToValue()); | 62 changes_list->Append(it->ToValue()); |
| 63 } | 63 } |
| 64 changes_value = changes_list; | 64 changes_value = changes_list; |
| 65 } else { | 65 } else { |
| 66 changes_value = | 66 changes_value = |
| 67 new base::StringValue(base::SizeTToString(changes_size) + " changes"); | 67 new base::Value(base::SizeTToString(changes_size) + " changes"); |
| 68 } | 68 } |
| 69 details.Set("changes", changes_value); | 69 details.Set("changes", changes_value); |
| 70 HandleJsEvent(FROM_HERE, "onChangesApplied", JsEventDetails(&details)); | 70 HandleJsEvent(FROM_HERE, "onChangesApplied", JsEventDetails(&details)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void JsMutationEventObserver::OnChangesComplete(ModelType model_type) { | 73 void JsMutationEventObserver::OnChangesComplete(ModelType model_type) { |
| 74 if (!event_handler_.IsInitialized()) { | 74 if (!event_handler_.IsInitialized()) { |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 base::DictionaryValue details; | 77 base::DictionaryValue details; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 98 const std::string& name, | 98 const std::string& name, |
| 99 const JsEventDetails& details) { | 99 const JsEventDetails& details) { |
| 100 if (!event_handler_.IsInitialized()) { | 100 if (!event_handler_.IsInitialized()) { |
| 101 NOTREACHED(); | 101 NOTREACHED(); |
| 102 return; | 102 return; |
| 103 } | 103 } |
| 104 event_handler_.Call(from_here, &JsEventHandler::HandleJsEvent, name, details); | 104 event_handler_.Call(from_here, &JsEventHandler::HandleJsEvent, name, details); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace syncer | 107 } // namespace syncer |
| OLD | NEW |