OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_WEBRTC_DEVICE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_WEBRTC_DEVICE_PROVIDER_H_ |
| 7 |
| 8 #include "chrome/browser/devtools/device/android_device_manager.h" |
| 9 #include "content/public/browser/web_ui_controller.h" |
| 10 |
| 11 namespace content { |
| 12 class BrowserContext; |
| 13 class WebUI; |
| 14 } |
| 15 |
| 16 // Provides access to remote DevTools targets over WebRTC data channel and GCD. |
| 17 class WebRTCDeviceProvider final : public AndroidDeviceManager::DeviceProvider { |
| 18 public: |
| 19 class MessageHandler; |
| 20 |
| 21 /** |
| 22 * Provides resources for provider's background worker. Background worker |
| 23 * is a windowless page that implements most of functionality of the |
| 24 * provider. It sandboxes WebRTC connections with remote devices and other |
| 25 * provider implementation details. |
| 26 */ |
| 27 class WebUI : public content::WebUIController { |
| 28 public: |
| 29 explicit WebUI(content::WebUI* web_ui); |
| 30 ~WebUI() override; |
| 31 |
| 32 private: |
| 33 friend class WebRTCDeviceProvider; |
| 34 }; |
| 35 |
| 36 explicit WebRTCDeviceProvider(content::BrowserContext* context); |
| 37 |
| 38 void QueryDevices(const SerialsCallback& callback) override; |
| 39 |
| 40 void QueryDeviceInfo(const std::string& serial, |
| 41 const DeviceInfoCallback& callback) override; |
| 42 |
| 43 void OpenSocket(const std::string& serial, |
| 44 const std::string& socket_name, |
| 45 const SocketCallback& callback) override; |
| 46 |
| 47 private: |
| 48 class MessageHandlerImpl; |
| 49 friend class MessageHandlerImpl; |
| 50 |
| 51 ~WebRTCDeviceProvider(); |
| 52 |
| 53 scoped_ptr<content::WebContents> background_worker_; |
| 54 MessageHandlerImpl* handler_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(WebRTCDeviceProvider); |
| 57 }; |
| 58 |
| 59 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_WEBRTC_WEBRTC_DEVICE_PROVIDER_H_ |
OLD | NEW |