| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/sync_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void SyncInternalsMessageHandler::HandleRequestListOfTypes( | 136 void SyncInternalsMessageHandler::HandleRequestListOfTypes( |
| 137 const base::ListValue* args) { | 137 const base::ListValue* args) { |
| 138 DCHECK(args->empty()); | 138 DCHECK(args->empty()); |
| 139 base::DictionaryValue event_details; | 139 base::DictionaryValue event_details; |
| 140 std::unique_ptr<base::ListValue> type_list(new base::ListValue()); | 140 std::unique_ptr<base::ListValue> type_list(new base::ListValue()); |
| 141 ModelTypeSet protocol_types = syncer::ProtocolTypes(); | 141 ModelTypeSet protocol_types = syncer::ProtocolTypes(); |
| 142 for (ModelTypeSet::Iterator it = protocol_types.First(); | 142 for (ModelTypeSet::Iterator it = protocol_types.First(); |
| 143 it.Good(); it.Inc()) { | 143 it.Good(); it.Inc()) { |
| 144 type_list->Append(new base::StringValue(ModelTypeToString(it.Get()))); | 144 type_list->AppendString(ModelTypeToString(it.Get())); |
| 145 } | 145 } |
| 146 event_details.Set(sync_driver::sync_ui_util::kTypes, type_list.release()); | 146 event_details.Set(sync_driver::sync_ui_util::kTypes, type_list.release()); |
| 147 web_ui()->CallJavascriptFunction( | 147 web_ui()->CallJavascriptFunction( |
| 148 sync_driver::sync_ui_util::kDispatchEvent, | 148 sync_driver::sync_ui_util::kDispatchEvent, |
| 149 base::StringValue(sync_driver::sync_ui_util::kOnReceivedListOfTypes), | 149 base::StringValue(sync_driver::sync_ui_util::kOnReceivedListOfTypes), |
| 150 event_details); | 150 event_details); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void SyncInternalsMessageHandler::HandleGetAllNodes( | 153 void SyncInternalsMessageHandler::HandleGetAllNodes( |
| 154 const base::ListValue* args) { | 154 const base::ListValue* args) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 *value); | 243 *value); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Gets the ProfileSyncService of the underlying original profile. | 246 // Gets the ProfileSyncService of the underlying original profile. |
| 247 // May return NULL (e.g., if sync is disabled on the command line). | 247 // May return NULL (e.g., if sync is disabled on the command line). |
| 248 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { | 248 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { |
| 249 Profile* profile = Profile::FromWebUI(web_ui()); | 249 Profile* profile = Profile::FromWebUI(web_ui()); |
| 250 return ProfileSyncServiceFactory::GetForProfile( | 250 return ProfileSyncServiceFactory::GetForProfile( |
| 251 profile->GetOriginalProfile()); | 251 profile->GetOriginalProfile()); |
| 252 } | 252 } |
| OLD | NEW |