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/devtools/devtools_targets_ui.h" | 5 #include "chrome/browser/devtools/devtools_targets_ui.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 const base::ListValue& list) { | 508 const base::ListValue& list) { |
509 callback_.Run(source_id_, list); | 509 callback_.Run(source_id_, list); |
510 } | 510 } |
511 | 511 |
512 // PortForwardingStatusSerializer --------------------------------------------- | 512 // PortForwardingStatusSerializer --------------------------------------------- |
513 | 513 |
514 PortForwardingStatusSerializer::PortForwardingStatusSerializer( | 514 PortForwardingStatusSerializer::PortForwardingStatusSerializer( |
515 const Callback& callback, Profile* profile) | 515 const Callback& callback, Profile* profile) |
516 : callback_(callback), | 516 : callback_(callback), |
517 profile_(profile) { | 517 profile_(profile) { |
518 PortForwardingController* port_forwarding_controller = | 518 DevToolsAndroidBridge* android_bridge = |
519 PortForwardingController::Factory::GetForProfile(profile_); | 519 DevToolsAndroidBridge::Factory::GetForProfile(profile_); |
520 if (port_forwarding_controller) | 520 if (android_bridge) |
521 port_forwarding_controller->AddListener(this); | 521 android_bridge->AddPortForwardingListener(this); |
522 } | 522 } |
523 | 523 |
524 PortForwardingStatusSerializer::~PortForwardingStatusSerializer() { | 524 PortForwardingStatusSerializer::~PortForwardingStatusSerializer() { |
525 PortForwardingController* port_forwarding_controller = | 525 DevToolsAndroidBridge* android_bridge = |
526 PortForwardingController::Factory::GetForProfile(profile_); | 526 DevToolsAndroidBridge::Factory::GetForProfile(profile_); |
527 if (port_forwarding_controller) | 527 if (android_bridge) |
528 port_forwarding_controller->RemoveListener(this); | 528 android_bridge->RemovePortForwardingListener(this); |
529 } | 529 } |
530 | 530 |
531 void PortForwardingStatusSerializer::PortStatusChanged( | 531 void PortForwardingStatusSerializer::PortStatusChanged( |
532 const DevicesStatus& status) { | 532 const DevicesStatus& status) { |
533 base::DictionaryValue result; | 533 base::DictionaryValue result; |
534 for (DevicesStatus::const_iterator sit = status.begin(); | 534 for (DevicesStatus::const_iterator sit = status.begin(); |
535 sit != status.end(); ++sit) { | 535 sit != status.end(); ++sit) { |
536 base::DictionaryValue* device_status_dict = new base::DictionaryValue(); | 536 base::DictionaryValue* device_status_dict = new base::DictionaryValue(); |
537 const PortStatusMap& device_status_map = sit->second; | 537 const PortStatusMap& device_status_map = sit->second; |
538 for (PortStatusMap::const_iterator it = device_status_map.begin(); | 538 for (PortStatusMap::const_iterator it = device_status_map.begin(); |
539 it != device_status_map.end(); ++it) { | 539 it != device_status_map.end(); ++it) { |
540 device_status_dict->SetInteger( | 540 device_status_dict->SetInteger( |
541 base::StringPrintf("%d", it->first), it->second); | 541 base::StringPrintf("%d", it->first), it->second); |
542 } | 542 } |
543 | 543 |
544 std::string device_id = base::StringPrintf( | 544 std::string device_id = base::StringPrintf( |
545 kAdbDeviceIdFormat, | 545 kAdbDeviceIdFormat, |
546 sit->first.c_str()); | 546 sit->first.c_str()); |
547 result.Set(device_id, device_status_dict); | 547 result.Set(device_id, device_status_dict); |
548 } | 548 } |
549 callback_.Run(result); | 549 callback_.Run(result); |
550 } | 550 } |
OLD | NEW |