| 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 "components/browser_sync/profile_sync_service.h" | 10 #include "components/browser_sync/profile_sync_service.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (service) { | 144 if (service) { |
| 145 service->GetAllNodes( | 145 service->GetAllNodes( |
| 146 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes, | 146 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes, |
| 147 weak_ptr_factory_.GetWeakPtr(), request_id)); | 147 weak_ptr_factory_.GetWeakPtr(), request_id)); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SyncInternalsMessageHandler::OnReceivedAllNodes( | 151 void SyncInternalsMessageHandler::OnReceivedAllNodes( |
| 152 int request_id, | 152 int request_id, |
| 153 std::unique_ptr<base::ListValue> nodes) { | 153 std::unique_ptr<base::ListValue> nodes) { |
| 154 base::FundamentalValue id(request_id); | 154 base::Value id(request_id); |
| 155 web_ui()->CallJavascriptFunction(syncer::sync_ui_util::kGetAllNodesCallback, | 155 web_ui()->CallJavascriptFunction(syncer::sync_ui_util::kGetAllNodesCallback, |
| 156 id, *nodes); | 156 id, *nodes); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SyncInternalsMessageHandler::OnStateChanged() { | 159 void SyncInternalsMessageHandler::OnStateChanged() { |
| 160 SendAboutInfo(); | 160 SendAboutInfo(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SyncInternalsMessageHandler::OnProtocolEvent( | 163 void SyncInternalsMessageHandler::OnProtocolEvent( |
| 164 const syncer::ProtocolEvent& event) { | 164 const syncer::ProtocolEvent& event) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 base::StringValue(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); | 222 base::StringValue(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 |