| 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 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class CancellableTaskFactory; |
| 13 class WebLocalFrameImpl; | 14 class WebLocalFrameImpl; |
| 14 class WebViewImpl; | 15 class WebViewImpl; |
| 15 | 16 |
| 16 class InspectorEmulationAgent final : public InspectorBaseAgent<protocol::Emulat
ion::Metainfo> { | 17 class InspectorEmulationAgent final : public InspectorBaseAgent<protocol::Emulat
ion::Metainfo> { |
| 17 WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent); | 18 WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent); |
| 18 public: | 19 public: |
| 19 class Client { | 20 class Client { |
| 20 public: | 21 public: |
| 21 virtual ~Client() {} | 22 virtual ~Client() {} |
| 22 | 23 |
| 23 virtual void setCPUThrottlingRate(double rate) {} | 24 virtual void setCPUThrottlingRate(double rate) {} |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 static InspectorEmulationAgent* create(WebLocalFrameImpl*, Client*); | 27 static InspectorEmulationAgent* create(WebLocalFrameImpl*, Client*); |
| 27 ~InspectorEmulationAgent() override; | 28 ~InspectorEmulationAgent() override; |
| 28 | 29 |
| 29 // protocol::Dispatcher::EmulationCommandHandler implementation. | 30 // protocol::Dispatcher::EmulationCommandHandler implementation. |
| 30 void resetPageScaleFactor(ErrorString*) override; | 31 void resetPageScaleFactor(ErrorString*) override; |
| 31 void setPageScaleFactor(ErrorString*, double in_pageScaleFactor) override; | 32 void setPageScaleFactor(ErrorString*, double in_pageScaleFactor) override; |
| 32 void setScriptExecutionDisabled(ErrorString*, bool in_value) override; | 33 void setScriptExecutionDisabled(ErrorString*, bool in_value) override; |
| 33 void setTouchEmulationEnabled(ErrorString*, bool in_enabled, const protocol:
:Maybe<String>& in_configuration) override; | 34 void setTouchEmulationEnabled(ErrorString*, bool in_enabled, const protocol:
:Maybe<String>& in_configuration) override; |
| 34 void setEmulatedMedia(ErrorString*, const String& in_media) override; | 35 void setEmulatedMedia(ErrorString*, const String& in_media) override; |
| 35 void setCPUThrottlingRate(ErrorString*, double in_rate) override; | 36 void setCPUThrottlingRate(ErrorString*, double in_rate) override; |
| 36 void setVirtualTimePolicy(ErrorString*, const String& in_policy) override; | 37 void setVirtualTimePolicy(ErrorString*, const String& in_policy, const proto
col::Maybe<int>& in_virtualTimeBudgetMs) override; |
| 37 | 38 |
| 38 // InspectorBaseAgent overrides. | 39 // InspectorBaseAgent overrides. |
| 39 void disable(ErrorString*) override; | 40 void disable(ErrorString*) override; |
| 40 void restore() override; | 41 void restore() override; |
| 41 | 42 |
| 42 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 InspectorEmulationAgent(WebLocalFrameImpl*, Client*); | 46 InspectorEmulationAgent(WebLocalFrameImpl*, Client*); |
| 46 WebViewImpl* webViewImpl(); | 47 WebViewImpl* webViewImpl(); |
| 48 void virtualTimeBudgetExpired(); |
| 47 | 49 |
| 48 Member<WebLocalFrameImpl> m_webLocalFrameImpl; | 50 Member<WebLocalFrameImpl> m_webLocalFrameImpl; |
| 49 Client* m_client; | 51 Client* m_client; |
| 52 std::unique_ptr<CancellableTaskFactory> m_virtualTimeBudgetExpiredTask; |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 } // namespace blink | 55 } // namespace blink |
| 53 | 56 |
| 54 #endif // !defined(InspectorEmulationAgent_h) | 57 #endif // !defined(InspectorEmulationAgent_h) |
| OLD | NEW |