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_ANDROID_DEVICE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 typedef AndroidDeviceManager::CommandCallback CommandCallback; | 29 typedef AndroidDeviceManager::CommandCallback CommandCallback; |
30 typedef AndroidDeviceManager::SocketCallback SocketCallback; | 30 typedef AndroidDeviceManager::SocketCallback SocketCallback; |
31 | 31 |
32 Device(const std::string& serial, bool is_connected); | 32 Device(const std::string& serial, bool is_connected); |
33 | 33 |
34 virtual void RunCommand(const std::string& command, | 34 virtual void RunCommand(const std::string& command, |
35 const CommandCallback& callback) = 0; | 35 const CommandCallback& callback) = 0; |
36 virtual void OpenSocket(const std::string& socket_name, | 36 virtual void OpenSocket(const std::string& socket_name, |
37 const SocketCallback& callback) = 0; | 37 const SocketCallback& callback) = 0; |
38 virtual void HttpQuery(const std::string& la_name, | 38 void HttpQuery(const std::string& la_name, |
39 const std::string& request, | 39 const std::string& request, |
40 const CommandCallback& callback); | 40 const CommandCallback& callback); |
41 void HttpUpgrade(const std::string& la_name, | 41 void HttpUpgrade(const std::string& la_name, |
42 const std::string& request, | 42 const std::string& request, |
43 const SocketCallback& callback); | 43 const SocketCallback& callback); |
44 | 44 |
45 std::string serial() { return serial_; } | 45 std::string serial() { return serial_; } |
46 bool is_connected() { return is_connected_; } | 46 bool is_connected() { return is_connected_; } |
47 | 47 |
48 friend class base::RefCounted<Device>; | 48 friend class base::RefCounted<Device>; |
49 virtual ~Device(); | 49 virtual ~Device(); |
50 | 50 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 DeviceProvider(); | 85 DeviceProvider(); |
86 virtual ~DeviceProvider(); | 86 virtual ~DeviceProvider(); |
87 }; | 87 }; |
88 | 88 |
89 public: | 89 public: |
90 static scoped_refptr<DeviceProvider> GetAdbDeviceProvider(); | 90 static scoped_refptr<DeviceProvider> GetAdbDeviceProvider(); |
91 static scoped_refptr<DeviceProvider> GetUsbDeviceProvider(Profile* profile); | 91 static scoped_refptr<DeviceProvider> GetUsbDeviceProvider(Profile* profile); |
92 // Use only in a test and/or when DEBUG_DEVTOOLS is defined. | 92 // Use only in a test and/or when DEBUG_DEVTOOLS is defined. |
93 static scoped_refptr<DeviceProvider> GetSelfAsDeviceProvider(int port); | 93 static scoped_refptr<DeviceProvider> GetSelfAsDeviceProvider(int port); |
94 // Implemented in browser_tests. | |
95 static scoped_refptr<DeviceProvider> GetMockDeviceProviderForTest(); | |
96 | 94 |
97 static scoped_refptr<AndroidDeviceManager> Create(); | 95 static scoped_refptr<AndroidDeviceManager> Create(); |
98 | 96 |
99 typedef std::vector<scoped_refptr<DeviceProvider> > DeviceProviders; | 97 typedef std::vector<scoped_refptr<DeviceProvider> > DeviceProviders; |
100 typedef base::Callback<void (const std::vector<std::string>&)> | 98 typedef base::Callback<void (const std::vector<std::string>&)> |
101 QueryDevicesCallback; | 99 QueryDevicesCallback; |
102 | 100 |
103 void QueryDevices(const DeviceProviders& providers, | 101 void QueryDevices(const DeviceProviders& providers, |
104 const QueryDevicesCallback& callback); | 102 const QueryDevicesCallback& callback); |
105 | 103 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 138 |
141 Device* FindDevice(const std::string& serial); | 139 Device* FindDevice(const std::string& serial); |
142 | 140 |
143 typedef std::map<std::string, scoped_refptr<Device> > DeviceMap; | 141 typedef std::map<std::string, scoped_refptr<Device> > DeviceMap; |
144 DeviceMap devices_; | 142 DeviceMap devices_; |
145 | 143 |
146 bool stopped_; | 144 bool stopped_; |
147 }; | 145 }; |
148 | 146 |
149 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 147 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
OLD | NEW |