| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_hand
ler.h" | 5 #include "ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_hand
ler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 void SyncInternalsMessageHandler::HandleRequestListOfTypes( | 120 void SyncInternalsMessageHandler::HandleRequestListOfTypes( |
| 121 const base::ListValue* args) { | 121 const base::ListValue* args) { |
| 122 DCHECK(args->empty()); | 122 DCHECK(args->empty()); |
| 123 base::DictionaryValue event_details; | 123 base::DictionaryValue event_details; |
| 124 std::unique_ptr<base::ListValue> type_list(new base::ListValue()); | 124 std::unique_ptr<base::ListValue> type_list(new base::ListValue()); |
| 125 ModelTypeSet protocol_types = syncer::ProtocolTypes(); | 125 ModelTypeSet protocol_types = syncer::ProtocolTypes(); |
| 126 for (ModelTypeSet::Iterator it = protocol_types.First(); it.Good(); | 126 for (ModelTypeSet::Iterator it = protocol_types.First(); it.Good(); |
| 127 it.Inc()) { | 127 it.Inc()) { |
| 128 type_list->Append(new base::Value(ModelTypeToString(it.Get()))); | 128 type_list->AppendString(ModelTypeToString(it.Get())); |
| 129 } | 129 } |
| 130 event_details.Set(syncer::sync_ui_util::kTypes, type_list.release()); | 130 event_details.Set(syncer::sync_ui_util::kTypes, type_list.release()); |
| 131 web_ui()->CallJavascriptFunction( | 131 web_ui()->CallJavascriptFunction( |
| 132 syncer::sync_ui_util::kDispatchEvent, | 132 syncer::sync_ui_util::kDispatchEvent, |
| 133 base::Value(syncer::sync_ui_util::kOnReceivedListOfTypes), event_details); | 133 base::Value(syncer::sync_ui_util::kOnReceivedListOfTypes), event_details); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void SyncInternalsMessageHandler::HandleGetAllNodes( | 136 void SyncInternalsMessageHandler::HandleGetAllNodes( |
| 137 const base::ListValue* args) { | 137 const base::ListValue* args) { |
| 138 DCHECK_EQ(1U, args->GetSize()); | 138 DCHECK_EQ(1U, args->GetSize()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 base::Value(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); | 222 base::Value(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Gets the SyncService of the underlying original profile. May return null. | 225 // Gets the SyncService of the underlying original profile. May return null. |
| 226 syncer::SyncService* SyncInternalsMessageHandler::GetSyncService() { | 226 syncer::SyncService* SyncInternalsMessageHandler::GetSyncService() { |
| 227 ios::ChromeBrowserState* browser_state = | 227 ios::ChromeBrowserState* browser_state = |
| 228 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); | 228 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); |
| 229 return IOSChromeProfileSyncServiceFactory::GetForBrowserState( | 229 return IOSChromeProfileSyncServiceFactory::GetForBrowserState( |
| 230 browser_state->GetOriginalChromeBrowserState()); | 230 browser_state->GetOriginalChromeBrowserState()); |
| 231 } | 231 } |
| OLD | NEW |