| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 DispatchEvent(name, details.Get()); | 277 DispatchEvent(name, details.Get()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void SyncInternalsMessageHandler::SendAboutInfo() { | 280 void SyncInternalsMessageHandler::SendAboutInfo() { |
| 281 std::unique_ptr<DictionaryValue> value = | 281 std::unique_ptr<DictionaryValue> value = |
| 282 about_sync_data_delegate_.Run(GetSyncService(), chrome::GetChannel()); | 282 about_sync_data_delegate_.Run(GetSyncService(), chrome::GetChannel()); |
| 283 DispatchEvent(syncer::sync_ui_util::kOnAboutInfoUpdated, *value); | 283 DispatchEvent(syncer::sync_ui_util::kOnAboutInfoUpdated, *value); |
| 284 } | 284 } |
| 285 | 285 |
| 286 SyncService* SyncInternalsMessageHandler::GetSyncService() { | 286 SyncService* SyncInternalsMessageHandler::GetSyncService() { |
| 287 return ProfileSyncServiceFactory::GetForProfile( | 287 return ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( |
| 288 Profile::FromWebUI(web_ui())->GetOriginalProfile()); | 288 Profile::FromWebUI(web_ui())->GetOriginalProfile()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void SyncInternalsMessageHandler::DispatchEvent(const std::string& name, | 291 void SyncInternalsMessageHandler::DispatchEvent(const std::string& name, |
| 292 const Value& details_value) { | 292 const Value& details_value) { |
| 293 CallJavascriptFunction(syncer::sync_ui_util::kDispatchEvent, Value(name), | 293 CallJavascriptFunction(syncer::sync_ui_util::kDispatchEvent, Value(name), |
| 294 details_value); | 294 details_value); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void SyncInternalsMessageHandler::UnregisterModelNotifications() { | 297 void SyncInternalsMessageHandler::UnregisterModelNotifications() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 308 js_controller_->RemoveJsEventHandler(this); | 308 js_controller_->RemoveJsEventHandler(this); |
| 309 js_controller_ = nullptr; | 309 js_controller_ = nullptr; |
| 310 is_registered_ = false; | 310 is_registered_ = false; |
| 311 } | 311 } |
| 312 | 312 |
| 313 if (is_registered_for_counters_) { | 313 if (is_registered_for_counters_) { |
| 314 service->RemoveTypeDebugInfoObserver(this); | 314 service->RemoveTypeDebugInfoObserver(this); |
| 315 is_registered_for_counters_ = false; | 315 is_registered_for_counters_ = false; |
| 316 } | 316 } |
| 317 } | 317 } |
| OLD | NEW |