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