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