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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 if (description.id.empty()) { | 363 if (description.id.empty()) { |
364 info.SetString(kDictionaryKeyServiceName, name); | 364 info.SetString(kDictionaryKeyServiceName, name); |
365 info.SetString(kDictionaryKeyDisplayName, description.name); | 365 info.SetString(kDictionaryKeyDisplayName, description.name); |
366 info.SetString(kDictionaryKeyDescription, description.description); | 366 info.SetString(kDictionaryKeyDescription, description.description); |
367 info.SetString(kDictionaryKeyType, description.type); | 367 info.SetString(kDictionaryKeyType, description.type); |
368 info.SetBoolean(kDictionaryKeyIsWifi, false); | 368 info.SetBoolean(kDictionaryKeyIsWifi, false); |
369 | 369 |
370 web_ui()->CallJavascriptFunction( | 370 web_ui()->CallJavascriptFunction( |
371 "local_discovery.onUnregisteredDeviceUpdate", service_key, info); | 371 "local_discovery.onUnregisteredDeviceUpdate", service_key, info); |
372 } else { | 372 } else { |
373 scoped_ptr<base::Value> null_value(base::Value::CreateNullValue()); | 373 scoped_ptr<base::Value> null_value = base::Value::CreateNullValue(); |
374 | 374 |
375 web_ui()->CallJavascriptFunction( | 375 web_ui()->CallJavascriptFunction( |
376 "local_discovery.onUnregisteredDeviceUpdate", service_key, *null_value); | 376 "local_discovery.onUnregisteredDeviceUpdate", service_key, *null_value); |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 void LocalDiscoveryUIHandler::DeviceRemoved(const std::string& name) { | 380 void LocalDiscoveryUIHandler::DeviceRemoved(const std::string& name) { |
381 device_descriptions_.erase(name); | 381 device_descriptions_.erase(name); |
382 scoped_ptr<base::Value> null_value(base::Value::CreateNullValue()); | 382 scoped_ptr<base::Value> null_value = base::Value::CreateNullValue(); |
383 base::StringValue name_value(kKeyPrefixMDns + name); | 383 base::StringValue name_value(kKeyPrefixMDns + name); |
384 | 384 |
385 web_ui()->CallJavascriptFunction("local_discovery.onUnregisteredDeviceUpdate", | 385 web_ui()->CallJavascriptFunction("local_discovery.onUnregisteredDeviceUpdate", |
386 name_value, *null_value); | 386 name_value, *null_value); |
387 } | 387 } |
388 | 388 |
389 void LocalDiscoveryUIHandler::DeviceCacheFlushed() { | 389 void LocalDiscoveryUIHandler::DeviceCacheFlushed() { |
390 web_ui()->CallJavascriptFunction("local_discovery.onDeviceCacheFlushed"); | 390 web_ui()->CallJavascriptFunction("local_discovery.onDeviceCacheFlushed"); |
391 privet_lister_->DiscoverNewDevices(false); | 391 privet_lister_->DiscoverNewDevices(false); |
392 } | 392 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 640 |
641 void LocalDiscoveryUIHandler::RefreshCloudPrintStatusFromService() { | 641 void LocalDiscoveryUIHandler::RefreshCloudPrintStatusFromService() { |
642 if (cloud_print_connector_ui_enabled_) | 642 if (cloud_print_connector_ui_enabled_) |
643 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))-> | 643 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()))-> |
644 RefreshStatusFromService(); | 644 RefreshStatusFromService(); |
645 } | 645 } |
646 | 646 |
647 #endif // cloud print connector option stuff | 647 #endif // cloud print connector option stuff |
648 | 648 |
649 } // namespace local_discovery | 649 } // namespace local_discovery |
OLD | NEW |