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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 void SyncInternalsMessageHandler::OnUpdateCountersUpdated( | 196 void SyncInternalsMessageHandler::OnUpdateCountersUpdated( |
197 syncer::ModelType type, | 197 syncer::ModelType type, |
198 const syncer::UpdateCounters& counters) { | 198 const syncer::UpdateCounters& counters) { |
199 EmitCounterUpdate(type, sync_driver::sync_ui_util::kUpdate, | 199 EmitCounterUpdate(type, sync_driver::sync_ui_util::kUpdate, |
200 counters.ToValue()); | 200 counters.ToValue()); |
201 } | 201 } |
202 | 202 |
203 void SyncInternalsMessageHandler::OnStatusCountersUpdated( | 203 void SyncInternalsMessageHandler::OnStatusCountersUpdated( |
204 syncer::ModelType type, | 204 syncer::ModelType type, |
205 const syncer::StatusCounters& counters) { | 205 std::unique_ptr<syncer::StatusCounters> counters) { |
206 EmitCounterUpdate(type, sync_driver::sync_ui_util::kStatus, | 206 EmitCounterUpdate(type, sync_driver::sync_ui_util::kStatus, |
207 counters.ToValue()); | 207 counters->ToValue()); |
208 } | 208 } |
209 | 209 |
210 void SyncInternalsMessageHandler::EmitCounterUpdate( | 210 void SyncInternalsMessageHandler::EmitCounterUpdate( |
211 syncer::ModelType type, | 211 syncer::ModelType type, |
212 const std::string& counter_type, | 212 const std::string& counter_type, |
213 std::unique_ptr<base::DictionaryValue> value) { | 213 std::unique_ptr<base::DictionaryValue> value) { |
214 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue()); | 214 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue()); |
215 details->SetString(sync_driver::sync_ui_util::kModelType, | 215 details->SetString(sync_driver::sync_ui_util::kModelType, |
216 ModelTypeToString(type)); | 216 ModelTypeToString(type)); |
217 details->SetString(sync_driver::sync_ui_util::kCounterType, counter_type); | 217 details->SetString(sync_driver::sync_ui_util::kCounterType, counter_type); |
(...skipping 26 matching lines...) Expand all Loading... |
244 *value); | 244 *value); |
245 } | 245 } |
246 | 246 |
247 // Gets the ProfileSyncService of the underlying original profile. | 247 // Gets the ProfileSyncService of the underlying original profile. |
248 // May return NULL (e.g., if sync is disabled on the command line). | 248 // May return NULL (e.g., if sync is disabled on the command line). |
249 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { | 249 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { |
250 Profile* profile = Profile::FromWebUI(web_ui()); | 250 Profile* profile = Profile::FromWebUI(web_ui()); |
251 return ProfileSyncServiceFactory::GetForProfile( | 251 return ProfileSyncServiceFactory::GetForProfile( |
252 profile->GetOriginalProfile()); | 252 profile->GetOriginalProfile()); |
253 } | 253 } |
OLD | NEW |