| 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_sync_manager_observer.h" | 5 #include "chrome/browser/sync/js_sync_manager_observer.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 syncable::ModelType model_type, | 27 syncable::ModelType model_type, |
| 28 const sync_api::BaseTransaction* trans, | 28 const sync_api::BaseTransaction* trans, |
| 29 const sync_api::SyncManager::ChangeRecord* changes, | 29 const sync_api::SyncManager::ChangeRecord* changes, |
| 30 int change_count) { | 30 int change_count) { |
| 31 ListValue return_args; | 31 ListValue return_args; |
| 32 return_args.Append(Value::CreateStringValue( | 32 return_args.Append(Value::CreateStringValue( |
| 33 syncable::ModelTypeToString(model_type))); | 33 syncable::ModelTypeToString(model_type))); |
| 34 ListValue* change_values = new ListValue(); | 34 ListValue* change_values = new ListValue(); |
| 35 return_args.Append(change_values); | 35 return_args.Append(change_values); |
| 36 for (int i = 0; i < change_count; ++i) { | 36 for (int i = 0; i < change_count; ++i) { |
| 37 change_values->Append(changes->ToValue(trans)); | 37 change_values->Append(changes[i].ToValue(trans)); |
| 38 } | 38 } |
| 39 parent_router_->RouteJsEvent("onChangesApplied", | 39 parent_router_->RouteJsEvent("onChangesApplied", |
| 40 JsArgList(return_args), NULL); | 40 JsArgList(return_args), NULL); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void JsSyncManagerObserver::OnChangesComplete( | 43 void JsSyncManagerObserver::OnChangesComplete( |
| 44 syncable::ModelType model_type) { | 44 syncable::ModelType model_type) { |
| 45 ListValue return_args; | 45 ListValue return_args; |
| 46 return_args.Append(Value::CreateStringValue( | 46 return_args.Append(Value::CreateStringValue( |
| 47 syncable::ModelTypeToString(model_type))); | 47 syncable::ModelTypeToString(model_type))); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void JsSyncManagerObserver::OnClearServerDataSucceeded() { | 108 void JsSyncManagerObserver::OnClearServerDataSucceeded() { |
| 109 parent_router_->RouteJsEvent("onClearServerDataSucceeded", | 109 parent_router_->RouteJsEvent("onClearServerDataSucceeded", |
| 110 JsArgList(), NULL); | 110 JsArgList(), NULL); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void JsSyncManagerObserver::OnClearServerDataFailed() { | 113 void JsSyncManagerObserver::OnClearServerDataFailed() { |
| 114 parent_router_->RouteJsEvent("onClearServerDataFailed", JsArgList(), NULL); | 114 parent_router_->RouteJsEvent("onClearServerDataFailed", JsArgList(), NULL); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace browser_sync | 117 } // namespace browser_sync |
| OLD | NEW |