| 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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_SELF_DEVICE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_TCP_DEVICE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_SELF_DEVICE_PROVIDER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_TCP_DEVICE_PROVIDER_H_ |
| 7 |
| 8 #include <set> |
| 7 | 9 |
| 8 #include "chrome/browser/devtools/device/android_device_manager.h" | 10 #include "chrome/browser/devtools/device/android_device_manager.h" |
| 11 #include "net/base/host_port_pair.h" |
| 9 | 12 |
| 10 // Instantiate this class only in a test and/or when DEBUG_DEVTOOLS is defined. | 13 // Instantiate this class only in a test and/or when DEBUG_DEVTOOLS is defined. |
| 11 class SelfAsDeviceProvider : public AndroidDeviceManager::DeviceProvider { | 14 class TCPDeviceProvider : public AndroidDeviceManager::DeviceProvider { |
| 12 public: | 15 public: |
| 13 explicit SelfAsDeviceProvider(int port); | 16 static scoped_refptr<TCPDeviceProvider> CreateForLocalhost(uint16_t port); |
| 17 |
| 18 using HostPortSet = std::set<net::HostPortPair>; |
| 19 explicit TCPDeviceProvider(const HostPortSet& targets); |
| 14 | 20 |
| 15 void QueryDevices(const SerialsCallback& callback) override; | 21 void QueryDevices(const SerialsCallback& callback) override; |
| 16 | 22 |
| 17 void QueryDeviceInfo(const std::string& serial, | 23 void QueryDeviceInfo(const std::string& serial, |
| 18 const DeviceInfoCallback& callback) override; | 24 const DeviceInfoCallback& callback) override; |
| 19 | 25 |
| 20 void OpenSocket(const std::string& serial, | 26 void OpenSocket(const std::string& serial, |
| 21 const std::string& socket_name, | 27 const std::string& socket_name, |
| 22 const SocketCallback& callback) override; | 28 const SocketCallback& callback) override; |
| 23 | 29 |
| 24 void ReleaseDevice(const std::string& serial) override; | 30 void ReleaseDevice(const std::string& serial) override; |
| 25 | 31 |
| 26 void set_release_callback_for_test(const base::Closure& callback); | 32 void set_release_callback_for_test(const base::Closure& callback); |
| 27 | 33 |
| 28 private: | 34 private: |
| 29 ~SelfAsDeviceProvider() override; | 35 ~TCPDeviceProvider() override; |
| 30 | 36 |
| 31 int port_; | 37 HostPortSet targets_; |
| 32 base::Closure release_callback_; | 38 base::Closure release_callback_; |
| 33 }; | 39 }; |
| 34 | 40 |
| 35 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_SELF_DEVICE_PROVIDER_H_ | 41 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_TCP_DEVICE_PROVIDER_H_ |
| OLD | NEW |