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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace emulation { | 21 namespace emulation { |
22 | 22 |
23 class EmulationHandler { | 23 class EmulationHandler { |
24 public: | 24 public: |
25 using Response = DevToolsProtocolClient::Response; | 25 using Response = DevToolsProtocolClient::Response; |
26 | 26 |
27 EmulationHandler(); | 27 EmulationHandler(); |
28 ~EmulationHandler(); | 28 ~EmulationHandler(); |
29 | 29 |
30 void SetRenderFrameHost(RenderFrameHostImpl* host); | 30 void SetRenderFrameHost(RenderFrameHostImpl* host); |
| 31 void SetClient(std::unique_ptr<Client> client) { } |
31 void Detached(); | 32 void Detached(); |
32 | 33 |
33 Response SetGeolocationOverride(double* latitude, | 34 Response SetGeolocationOverride(double* latitude, |
34 double* longitude, | 35 double* longitude, |
35 double* accuracy); | 36 double* accuracy); |
36 Response ClearGeolocationOverride(); | 37 Response ClearGeolocationOverride(); |
37 | 38 |
38 Response SetTouchEmulationEnabled(bool enabled, | 39 Response SetTouchEmulationEnabled(bool enabled, |
39 const std::string* configuration); | 40 const std::string* configuration); |
40 | 41 |
41 Response CanEmulate(bool* result); | 42 Response CanEmulate(bool* result); |
42 Response SetDeviceMetricsOverride( | 43 Response SetDeviceMetricsOverride( |
43 int width, | 44 int width, |
44 int height, | 45 int height, |
45 double device_scale_factor, | 46 double device_scale_factor, |
46 bool mobile, | 47 bool mobile, |
47 bool fit_window, | 48 bool fit_window, |
48 const double* optional_scale, | 49 const double* optional_scale, |
49 const double* optional_offset_x, | 50 const double* optional_offset_x, |
50 const double* optional_offset_y, | 51 const double* optional_offset_y, |
51 const int* screen_widget, | 52 const int* screen_widget, |
52 const int* screen_height, | 53 const int* screen_height, |
53 const int* position_x, | 54 const int* position_x, |
54 const int* position_y, | 55 const int* position_y, |
55 const std::unique_ptr<base::DictionaryValue>& screen_orientation); | 56 const std::unique_ptr<base::DictionaryValue>& screen_orientation); |
56 Response ClearDeviceMetricsOverride(); | 57 Response ClearDeviceMetricsOverride(); |
57 | 58 |
58 Response SetVisibleSize(int width, int height); | 59 Response SetVisibleSize(int width, int height); |
59 | 60 |
| 61 Response ForceViewport(double x, double y, double scale); |
| 62 Response ResetViewport(); |
| 63 Response ResetPageScaleFactor(); |
| 64 Response SetPageScaleFactor(double page_scale_factor); |
| 65 Response SetScriptExecutionDisabled(bool disabled); |
| 66 Response SetEmulatedMedia(const std::string& media); |
| 67 Response SetCPUThrottlingRate(double rate); |
| 68 Response SetVirtualTimePolicy(const std::string& policy, const int* budget); |
| 69 |
60 private: | 70 private: |
61 WebContentsImpl* GetWebContents(); | 71 WebContentsImpl* GetWebContents(); |
62 void UpdateTouchEventEmulationState(); | 72 void UpdateTouchEventEmulationState(); |
63 void UpdateDeviceEmulationState(); | 73 void UpdateDeviceEmulationState(); |
64 | 74 |
65 bool touch_emulation_enabled_; | 75 bool touch_emulation_enabled_; |
66 std::string touch_emulation_configuration_; | 76 std::string touch_emulation_configuration_; |
67 | 77 |
68 bool device_emulation_enabled_; | 78 bool device_emulation_enabled_; |
69 blink::WebDeviceEmulationParams device_emulation_params_; | 79 blink::WebDeviceEmulationParams device_emulation_params_; |
70 | 80 |
71 RenderFrameHostImpl* host_; | 81 RenderFrameHostImpl* host_; |
72 | 82 |
73 DISALLOW_COPY_AND_ASSIGN(EmulationHandler); | 83 DISALLOW_COPY_AND_ASSIGN(EmulationHandler); |
74 }; | 84 }; |
75 | 85 |
76 } // namespace emulation | 86 } // namespace emulation |
77 } // namespace devtools | 87 } // namespace devtools |
78 } // namespace content | 88 } // namespace content |
79 | 89 |
80 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ | 90 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ |
OLD | NEW |