| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 web_ui()->CallJavascriptFunction( | 131 web_ui()->CallJavascriptFunction( |
| 132 syncer::sync_ui_util::kDispatchEvent, | 132 syncer::sync_ui_util::kDispatchEvent, |
| 133 base::StringValue(syncer::sync_ui_util::kOnReceivedListOfTypes), | 133 base::StringValue(syncer::sync_ui_util::kOnReceivedListOfTypes), |
| 134 event_details); | 134 event_details); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void SyncInternalsMessageHandler::HandleGetAllNodes( | 137 void SyncInternalsMessageHandler::HandleGetAllNodes( |
| 138 const base::ListValue* args) { | 138 const base::ListValue* args) { |
| 139 DCHECK_EQ(1U, args->GetSize()); | 139 DCHECK_EQ(1U, args->GetSize()); |
| 140 int request_id = 0; | 140 int request_id = 0; |
| 141 bool success = args->GetInteger(0, &request_id); | 141 bool success = ExtractIntegerValue(args, &request_id); |
| 142 DCHECK(success); | 142 DCHECK(success); |
| 143 | 143 |
| 144 syncer::SyncService* service = GetSyncService(); | 144 syncer::SyncService* service = GetSyncService(); |
| 145 if (service) { | 145 if (service) { |
| 146 service->GetAllNodes( | 146 service->GetAllNodes( |
| 147 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes, | 147 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes, |
| 148 weak_ptr_factory_.GetWeakPtr(), request_id)); | 148 weak_ptr_factory_.GetWeakPtr(), request_id)); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 base::StringValue(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); | 223 base::StringValue(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Gets the SyncService of the underlying original profile. May return null. | 226 // Gets the SyncService of the underlying original profile. May return null. |
| 227 syncer::SyncService* SyncInternalsMessageHandler::GetSyncService() { | 227 syncer::SyncService* SyncInternalsMessageHandler::GetSyncService() { |
| 228 ios::ChromeBrowserState* browser_state = | 228 ios::ChromeBrowserState* browser_state = |
| 229 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); | 229 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); |
| 230 return IOSChromeProfileSyncServiceFactory::GetForBrowserState( | 230 return IOSChromeProfileSyncServiceFactory::GetForBrowserState( |
| 231 browser_state->GetOriginalChromeBrowserState()); | 231 browser_state->GetOriginalChromeBrowserState()); |
| 232 } | 232 } |
| OLD | NEW |