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_DEVTOOLS_ANDROID_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 public: | 183 public: |
184 using PortStatusMap = DevToolsAndroidBridge::PortStatusMap; | 184 using PortStatusMap = DevToolsAndroidBridge::PortStatusMap; |
185 using BrowserStatus = DevToolsAndroidBridge::BrowserStatus; | 185 using BrowserStatus = DevToolsAndroidBridge::BrowserStatus; |
186 using ForwardingStatus = DevToolsAndroidBridge::ForwardingStatus; | 186 using ForwardingStatus = DevToolsAndroidBridge::ForwardingStatus; |
187 | 187 |
188 virtual void PortStatusChanged(const ForwardingStatus&) = 0; | 188 virtual void PortStatusChanged(const ForwardingStatus&) = 0; |
189 protected: | 189 protected: |
190 virtual ~PortForwardingListener() {} | 190 virtual ~PortForwardingListener() {} |
191 }; | 191 }; |
192 | 192 |
| 193 using CompleteDevice = std::pair<scoped_refptr<AndroidDeviceManager::Device>, |
| 194 scoped_refptr<RemoteDevice>>; |
| 195 using CompleteDevices = std::vector<CompleteDevice>; |
| 196 using DeviceListCallback = base::Callback<void(const CompleteDevices&)>; |
| 197 |
| 198 static void QueryCompleteDevices( |
| 199 AndroidDeviceManager* device_manager, |
| 200 const DeviceListCallback& callback); |
| 201 |
193 void AddPortForwardingListener(PortForwardingListener* listener); | 202 void AddPortForwardingListener(PortForwardingListener* listener); |
194 void RemovePortForwardingListener(PortForwardingListener* listener); | 203 void RemovePortForwardingListener(PortForwardingListener* listener); |
195 | 204 |
196 void set_device_providers_for_test( | 205 void set_device_providers_for_test( |
197 const AndroidDeviceManager::DeviceProviders& device_providers) { | 206 const AndroidDeviceManager::DeviceProviders& device_providers) { |
198 device_manager_->SetDeviceProviders(device_providers); | 207 device_manager_->SetDeviceProviders(device_providers); |
199 } | 208 } |
200 | 209 |
201 void set_task_scheduler_for_test( | 210 void set_task_scheduler_for_test( |
202 base::Callback<void(const base::Closure&)> scheduler) { | 211 base::Callback<void(const base::Closure&)> scheduler) { |
203 task_scheduler_ = scheduler; | 212 task_scheduler_ = scheduler; |
204 } | 213 } |
205 | 214 |
206 using RemotePageCallback = base::Callback<void(scoped_refptr<RemotePage>)>; | 215 using RemotePageCallback = base::Callback<void(scoped_refptr<RemotePage>)>; |
207 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, | 216 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, |
208 const std::string& url); | 217 const std::string& url); |
209 | 218 |
210 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 219 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
211 scoped_refptr<RemoteBrowser> browser); | 220 scoped_refptr<RemoteBrowser> browser); |
212 | 221 |
213 void SendJsonRequest(const std::string& browser_id_str, | 222 void SendJsonRequest(const std::string& browser_id_str, |
214 const std::string& url, | 223 const std::string& url, |
215 const JsonRequestCallback& callback); | 224 const JsonRequestCallback& callback); |
216 | 225 |
217 using TCPProviderCallback = | 226 using TCPProviderCallback = |
218 base::Callback<void(scoped_refptr<TCPDeviceProvider>)>; | 227 base::Callback<void(scoped_refptr<TCPDeviceProvider>)>; |
219 void set_tcp_provider_callback_for_test(TCPProviderCallback callback); | 228 void set_tcp_provider_callback_for_test(TCPProviderCallback callback); |
220 | 229 |
221 using CompleteDevice = std::pair<scoped_refptr<AndroidDeviceManager::Device>, | |
222 scoped_refptr<RemoteDevice>>; | |
223 using CompleteDevices = std::vector<CompleteDevice>; | |
224 using DeviceListCallback = base::Callback<void(const CompleteDevices&)>; | |
225 | |
226 private: | 230 private: |
227 friend struct content::BrowserThread::DeleteOnThread< | 231 friend struct content::BrowserThread::DeleteOnThread< |
228 content::BrowserThread::UI>; | 232 content::BrowserThread::UI>; |
229 friend class base::DeleteHelper<DevToolsAndroidBridge>; | 233 friend class base::DeleteHelper<DevToolsAndroidBridge>; |
230 | 234 |
231 class AgentHostDelegate; | 235 class AgentHostDelegate; |
232 class DiscoveryRequest; | 236 class DiscoveryRequest; |
233 class RemotePageTarget; | 237 class RemotePageTarget; |
234 | 238 |
235 ~DevToolsAndroidBridge() override; | 239 ~DevToolsAndroidBridge() override; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 PrefChangeRegistrar pref_change_registrar_; | 281 PrefChangeRegistrar pref_change_registrar_; |
278 | 282 |
279 TCPProviderCallback tcp_provider_callback_; | 283 TCPProviderCallback tcp_provider_callback_; |
280 | 284 |
281 base::WeakPtrFactory<DevToolsAndroidBridge> weak_factory_; | 285 base::WeakPtrFactory<DevToolsAndroidBridge> weak_factory_; |
282 | 286 |
283 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); | 287 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); |
284 }; | 288 }; |
285 | 289 |
286 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 290 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
OLD | NEW |