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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // Creates new target instance owned by caller. | 219 // Creates new target instance owned by caller. |
220 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); | 220 DevToolsTargetImpl* CreatePageTarget(scoped_refptr<RemotePage> browser); |
221 | 221 |
222 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; | 222 typedef base::Callback<void(scoped_refptr<RemotePage>)> RemotePageCallback; |
223 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, | 223 void OpenRemotePage(scoped_refptr<RemoteBrowser> browser, |
224 const std::string& url, | 224 const std::string& url, |
225 const RemotePageCallback& callback); | 225 const RemotePageCallback& callback); |
226 | 226 |
227 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 227 scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
228 scoped_refptr<RemoteBrowser> browser); | 228 scoped_refptr<RemoteBrowser> browser); |
229 | |
230 typedef std::pair<scoped_refptr<AndroidDeviceManager::Device>, | |
231 scoped_refptr<RemoteDevice>> CompleteDevice; | |
232 typedef std::vector<CompleteDevice> CompleteDevices; | |
233 typedef base::Callback<void(const CompleteDevices&)> DeviceListCallback; | |
234 | |
235 private: | 229 private: |
236 friend struct content::BrowserThread::DeleteOnThread< | 230 friend struct content::BrowserThread::DeleteOnThread< |
237 content::BrowserThread::UI>; | 231 content::BrowserThread::UI>; |
238 friend class base::DeleteHelper<DevToolsAndroidBridge>; | 232 friend class base::DeleteHelper<DevToolsAndroidBridge>; |
239 | 233 |
| 234 friend class PortForwardingController; |
| 235 |
240 class AgentHostDelegate; | 236 class AgentHostDelegate; |
241 class DiscoveryRequest; | 237 class DiscoveryRequest; |
242 class RemotePageTarget; | 238 class RemotePageTarget; |
243 | 239 |
244 virtual ~DevToolsAndroidBridge(); | 240 virtual ~DevToolsAndroidBridge(); |
245 | 241 |
246 void StartDeviceListPolling(); | 242 void StartDeviceListPolling(); |
247 void StopDeviceListPolling(); | 243 void StopDeviceListPolling(); |
248 bool NeedsDeviceListPolling(); | 244 bool NeedsDeviceListPolling(); |
249 | 245 |
| 246 typedef std::pair<scoped_refptr<AndroidDeviceManager::Device>, |
| 247 scoped_refptr<RemoteDevice>> CompleteDevice; |
| 248 typedef std::vector<CompleteDevice> CompleteDevices; |
| 249 typedef base::Callback<void(const CompleteDevices&)> DeviceListCallback; |
| 250 |
250 void RequestDeviceList(const DeviceListCallback& callback); | 251 void RequestDeviceList(const DeviceListCallback& callback); |
251 | |
252 void ReceivedDeviceList(const CompleteDevices& complete_devices); | 252 void ReceivedDeviceList(const CompleteDevices& complete_devices); |
253 | 253 |
254 void StartDeviceCountPolling(); | 254 void StartDeviceCountPolling(); |
255 void StopDeviceCountPolling(); | 255 void StopDeviceCountPolling(); |
256 void RequestDeviceCount(const base::Callback<void(int)>& callback); | 256 void RequestDeviceCount(const base::Callback<void(int)>& callback); |
257 void ReceivedDeviceCount(int count); | 257 void ReceivedDeviceCount(int count); |
258 | 258 |
259 static void ScheduleTaskDefault(const base::Closure& task); | 259 static void ScheduleTaskDefault(const base::Closure& task); |
260 | 260 |
261 void CreateDeviceProviders(); | 261 void CreateDeviceProviders(); |
262 | 262 |
263 void SendJsonRequest(const BrowserId& browser_id, | 263 void SendJsonRequest(const BrowserId& browser_id, |
264 const std::string& url, | 264 const std::string& url, |
265 const JsonRequestCallback& callback); | 265 const JsonRequestCallback& callback); |
266 | 266 |
267 void SendProtocolCommand(const BrowserId& browser_id, | 267 void SendProtocolCommand(const BrowserId& browser_id, |
268 const std::string& debug_url, | 268 const std::string& debug_url, |
269 const std::string& method, | 269 const std::string& method, |
270 base::DictionaryValue* params, | 270 base::DictionaryValue* params, |
271 const base::Closure callback); | 271 const base::Closure callback); |
272 | 272 |
273 AndroidDeviceManager::AndroidWebSocket* CreateWebSocket( | 273 scoped_refptr<AndroidDeviceManager::Device> FindDevice( |
274 const BrowserId& browser_id, | 274 const std::string& serial); |
275 const std::string& url, | |
276 AndroidDeviceManager::AndroidWebSocket::Delegate* delegate); | |
277 | 275 |
278 void PageCreatedOnUIThread(scoped_refptr<RemoteBrowser> browser, | 276 void PageCreatedOnUIThread(scoped_refptr<RemoteBrowser> browser, |
279 const RemotePageCallback& callback, | 277 const RemotePageCallback& callback, |
280 const std::string& url, | 278 const std::string& url, |
281 int result, | 279 int result, |
282 const std::string& response); | 280 const std::string& response); |
283 | 281 |
284 void NavigatePageOnUIThread(scoped_refptr<RemoteBrowser> browser, | 282 void NavigatePageOnUIThread(scoped_refptr<RemoteBrowser> browser, |
285 const RemotePageCallback& callback, | 283 const RemotePageCallback& callback, |
286 int result, | 284 int result, |
(...skipping 26 matching lines...) Expand all Loading... |
313 | 311 |
314 typedef std::vector<PortForwardingListener*> PortForwardingListeners; | 312 typedef std::vector<PortForwardingListener*> PortForwardingListeners; |
315 PortForwardingListeners port_forwarding_listeners_; | 313 PortForwardingListeners port_forwarding_listeners_; |
316 scoped_ptr<PortForwardingController> port_forwarding_controller_; | 314 scoped_ptr<PortForwardingController> port_forwarding_controller_; |
317 | 315 |
318 PrefChangeRegistrar pref_change_registrar_; | 316 PrefChangeRegistrar pref_change_registrar_; |
319 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); | 317 DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge); |
320 }; | 318 }; |
321 | 319 |
322 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ | 320 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_DEVTOOLS_ANDROID_BRIDGE_H_ |
OLD | NEW |