OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ |
7 | 7 |
8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | 8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" |
9 #include "content/browser/devtools/protocol/page_handler.h" | 9 #include "content/browser/devtools/protocol/page_handler.h" |
10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class RenderViewHostImpl; | 14 class RenderFrameHostImpl; |
| 15 class WebContentsImpl; |
15 | 16 |
16 namespace devtools { | 17 namespace devtools { |
17 | 18 |
18 namespace page { class PageHandler; } | 19 namespace page { class PageHandler; } |
19 | 20 |
20 namespace emulation { | 21 namespace emulation { |
21 | 22 |
22 class EmulationHandler : public page::PageHandler::ScreencastListener { | 23 class EmulationHandler : public page::PageHandler::ScreencastListener { |
23 public: | 24 public: |
24 using Response = DevToolsProtocolClient::Response; | 25 using Response = DevToolsProtocolClient::Response; |
25 | 26 |
26 explicit EmulationHandler(page::PageHandler* page_handler); | 27 explicit EmulationHandler(page::PageHandler* page_handler); |
27 ~EmulationHandler() override; | 28 ~EmulationHandler() override; |
28 | 29 |
29 // page::PageHandler::ScreencastListener implementation. | 30 // page::PageHandler::ScreencastListener implementation. |
30 void ScreencastEnabledChanged() override; | 31 void ScreencastEnabledChanged() override; |
31 | 32 |
32 void SetRenderViewHost(RenderViewHostImpl* host); | 33 void SetRenderFrameHost(RenderFrameHostImpl* host); |
33 void Detached(); | 34 void Detached(); |
34 | 35 |
35 Response SetGeolocationOverride(double* latitude, | 36 Response SetGeolocationOverride(double* latitude, |
36 double* longitude, | 37 double* longitude, |
37 double* accuracy); | 38 double* accuracy); |
38 Response ClearGeolocationOverride(); | 39 Response ClearGeolocationOverride(); |
39 | 40 |
40 Response SetTouchEmulationEnabled(bool enabled, | 41 Response SetTouchEmulationEnabled(bool enabled, |
41 const std::string* configuration); | 42 const std::string* configuration); |
42 | 43 |
43 Response CanEmulate(bool* result); | 44 Response CanEmulate(bool* result); |
44 Response SetDeviceMetricsOverride(int width, | 45 Response SetDeviceMetricsOverride(int width, |
45 int height, | 46 int height, |
46 double device_scale_factor, | 47 double device_scale_factor, |
47 bool mobile, | 48 bool mobile, |
48 bool fit_window, | 49 bool fit_window, |
49 const double* optional_scale, | 50 const double* optional_scale, |
50 const double* optional_offset_x, | 51 const double* optional_offset_x, |
51 const double* optional_offset_y); | 52 const double* optional_offset_y); |
52 Response ClearDeviceMetricsOverride(); | 53 Response ClearDeviceMetricsOverride(); |
53 | 54 |
54 private: | 55 private: |
| 56 WebContentsImpl* GetWebContents(); |
55 void UpdateTouchEventEmulationState(); | 57 void UpdateTouchEventEmulationState(); |
56 void UpdateDeviceEmulationState(); | 58 void UpdateDeviceEmulationState(); |
57 | 59 |
58 bool touch_emulation_enabled_; | 60 bool touch_emulation_enabled_; |
59 std::string touch_emulation_configuration_; | 61 std::string touch_emulation_configuration_; |
60 | 62 |
61 bool device_emulation_enabled_; | 63 bool device_emulation_enabled_; |
62 blink::WebDeviceEmulationParams device_emulation_params_; | 64 blink::WebDeviceEmulationParams device_emulation_params_; |
63 | 65 |
64 page::PageHandler* page_handler_; | 66 page::PageHandler* page_handler_; |
65 RenderViewHostImpl* host_; | 67 RenderFrameHostImpl* host_; |
66 | 68 |
67 DISALLOW_COPY_AND_ASSIGN(EmulationHandler); | 69 DISALLOW_COPY_AND_ASSIGN(EmulationHandler); |
68 }; | 70 }; |
69 | 71 |
70 } // namespace emulation | 72 } // namespace emulation |
71 } // namespace devtools | 73 } // namespace devtools |
72 } // namespace content | 74 } // namespace content |
73 | 75 |
74 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ | 76 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ |
OLD | NEW |