| 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 InspectorEmulationAgent_h | 5 #ifndef InspectorEmulationAgent_h |
| 6 #define InspectorEmulationAgent_h | 6 #define InspectorEmulationAgent_h |
| 7 | 7 |
| 8 #include "core/inspector/InspectorBaseAgent.h" | 8 #include "core/inspector/InspectorBaseAgent.h" |
| 9 #include "core/inspector/protocol/Emulation.h" | 9 #include "core/inspector/protocol/Emulation.h" |
| 10 #include "platform/WebTaskRunner.h" | 10 #include "platform/WebTaskRunner.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class WebLocalFrameImpl; | 14 class WebLocalFrameImpl; |
| 15 class WebViewImpl; | 15 class WebViewImpl; |
| 16 | 16 |
| 17 namespace protocol { |
| 18 namespace DOM { |
| 19 class RGBA; |
| 20 } // namespace DOM |
| 21 } // namespace protocol |
| 22 |
| 17 class InspectorEmulationAgent final | 23 class InspectorEmulationAgent final |
| 18 : public InspectorBaseAgent<protocol::Emulation::Metainfo> { | 24 : public InspectorBaseAgent<protocol::Emulation::Metainfo> { |
| 19 WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent); | 25 WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent); |
| 20 | 26 |
| 21 public: | 27 public: |
| 22 class Client { | 28 class Client { |
| 23 public: | 29 public: |
| 24 virtual ~Client() {} | 30 virtual ~Client() {} |
| 25 | 31 |
| 26 virtual void setCPUThrottlingRate(double rate) {} | 32 virtual void setCPUThrottlingRate(double rate) {} |
| 27 }; | 33 }; |
| 28 | 34 |
| 29 static InspectorEmulationAgent* create(WebLocalFrameImpl*, Client*); | 35 static InspectorEmulationAgent* create(WebLocalFrameImpl*, Client*); |
| 30 ~InspectorEmulationAgent() override; | 36 ~InspectorEmulationAgent() override; |
| 31 | 37 |
| 32 // protocol::Dispatcher::EmulationCommandHandler implementation. | 38 // protocol::Dispatcher::EmulationCommandHandler implementation. |
| 33 Response forceViewport(double x, double y, double scale) override; | 39 Response forceViewport(double x, double y, double scale) override; |
| 34 Response resetViewport() override; | 40 Response resetViewport() override; |
| 35 Response resetPageScaleFactor() override; | 41 Response resetPageScaleFactor() override; |
| 36 Response setPageScaleFactor(double) override; | 42 Response setPageScaleFactor(double) override; |
| 37 Response setScriptExecutionDisabled(bool value) override; | 43 Response setScriptExecutionDisabled(bool value) override; |
| 38 Response setTouchEmulationEnabled(bool enabled, | 44 Response setTouchEmulationEnabled(bool enabled, |
| 39 Maybe<String> configuration) override; | 45 Maybe<String> configuration) override; |
| 40 Response setEmulatedMedia(const String&) override; | 46 Response setEmulatedMedia(const String&) override; |
| 41 Response setCPUThrottlingRate(double) override; | 47 Response setCPUThrottlingRate(double) override; |
| 42 Response setVirtualTimePolicy(const String& policy, | 48 Response setVirtualTimePolicy(const String& policy, |
| 43 Maybe<int> virtualTimeBudgetMs) override; | 49 Maybe<int> virtualTimeBudgetMs) override; |
| 50 Response setDefaultBackgroundColorOverride( |
| 51 Maybe<protocol::DOM::RGBA>) override; |
| 44 | 52 |
| 45 // InspectorBaseAgent overrides. | 53 // InspectorBaseAgent overrides. |
| 46 Response disable() override; | 54 Response disable() override; |
| 47 void restore() override; | 55 void restore() override; |
| 48 | 56 |
| 49 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 50 | 58 |
| 51 private: | 59 private: |
| 52 InspectorEmulationAgent(WebLocalFrameImpl*, Client*); | 60 InspectorEmulationAgent(WebLocalFrameImpl*, Client*); |
| 53 WebViewImpl* webViewImpl(); | 61 WebViewImpl* webViewImpl(); |
| 54 void virtualTimeBudgetExpired(); | 62 void virtualTimeBudgetExpired(); |
| 55 | 63 |
| 56 Member<WebLocalFrameImpl> m_webLocalFrameImpl; | 64 Member<WebLocalFrameImpl> m_webLocalFrameImpl; |
| 57 Client* m_client; | 65 Client* m_client; |
| 58 TaskHandle m_virtualTimeBudgetExpiredTaskHandle; | 66 TaskHandle m_virtualTimeBudgetExpiredTaskHandle; |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 } // namespace blink | 69 } // namespace blink |
| 62 | 70 |
| 63 #endif // !defined(InspectorEmulationAgent_h) | 71 #endif // !defined(InspectorEmulationAgent_h) |
| OLD | NEW |