| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/local_discovery_ui_handler.h" | 5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (description.id.empty()) { | 354 if (description.id.empty()) { |
| 355 info.SetString(kDictionaryKeyServiceName, name); | 355 info.SetString(kDictionaryKeyServiceName, name); |
| 356 info.SetString(kDictionaryKeyDisplayName, description.name); | 356 info.SetString(kDictionaryKeyDisplayName, description.name); |
| 357 info.SetString(kDictionaryKeyDescription, description.description); | 357 info.SetString(kDictionaryKeyDescription, description.description); |
| 358 info.SetString(kDictionaryKeyType, description.type); | 358 info.SetString(kDictionaryKeyType, description.type); |
| 359 info.SetBoolean(kDictionaryKeyIsWifi, false); | 359 info.SetBoolean(kDictionaryKeyIsWifi, false); |
| 360 | 360 |
| 361 web_ui()->CallJavascriptFunctionUnsafe( | 361 web_ui()->CallJavascriptFunctionUnsafe( |
| 362 "local_discovery.onUnregisteredDeviceUpdate", service_key, info); | 362 "local_discovery.onUnregisteredDeviceUpdate", service_key, info); |
| 363 } else { | 363 } else { |
| 364 std::unique_ptr<base::Value> null_value = base::Value::CreateNullValue(); | 364 auto null_value = base::MakeUnique<base::Value>(); |
| 365 | 365 |
| 366 web_ui()->CallJavascriptFunctionUnsafe( | 366 web_ui()->CallJavascriptFunctionUnsafe( |
| 367 "local_discovery.onUnregisteredDeviceUpdate", service_key, *null_value); | 367 "local_discovery.onUnregisteredDeviceUpdate", service_key, *null_value); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 void LocalDiscoveryUIHandler::DeviceRemoved(const std::string& name) { | 371 void LocalDiscoveryUIHandler::DeviceRemoved(const std::string& name) { |
| 372 device_descriptions_.erase(name); | 372 device_descriptions_.erase(name); |
| 373 std::unique_ptr<base::Value> null_value = base::Value::CreateNullValue(); | 373 auto null_value = base::MakeUnique<base::Value>(); |
| 374 base::Value name_value(kKeyPrefixMDns + name); | 374 base::Value name_value(kKeyPrefixMDns + name); |
| 375 | 375 |
| 376 web_ui()->CallJavascriptFunctionUnsafe( | 376 web_ui()->CallJavascriptFunctionUnsafe( |
| 377 "local_discovery.onUnregisteredDeviceUpdate", name_value, *null_value); | 377 "local_discovery.onUnregisteredDeviceUpdate", name_value, *null_value); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void LocalDiscoveryUIHandler::DeviceCacheFlushed() { | 380 void LocalDiscoveryUIHandler::DeviceCacheFlushed() { |
| 381 web_ui()->CallJavascriptFunctionUnsafe( | 381 web_ui()->CallJavascriptFunctionUnsafe( |
| 382 "local_discovery.onDeviceCacheFlushed"); | 382 "local_discovery.onDeviceCacheFlushed"); |
| 383 privet_lister_->DiscoverNewDevices(false); | 383 privet_lister_->DiscoverNewDevices(false); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 service->RefreshStatusFromService(); | 610 service->RefreshStatusFromService(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { | 613 CloudPrintProxyService* LocalDiscoveryUIHandler::GetCloudPrintProxyService() { |
| 614 return CloudPrintProxyServiceFactory::GetForProfile( | 614 return CloudPrintProxyServiceFactory::GetForProfile( |
| 615 Profile::FromWebUI(web_ui())); | 615 Profile::FromWebUI(web_ui())); |
| 616 } | 616 } |
| 617 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) | 617 #endif // defined(CLOUD_PRINT_CONNECTOR_UI_AVAILABLE) |
| 618 | 618 |
| 619 } // namespace local_discovery | 619 } // namespace local_discovery |
| OLD | NEW |