summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/web/InspectorEmulationAgent.h
blob: cf8f4512f8a7a32ad81637f60b01b0533046b142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef InspectorEmulationAgent_h
#define InspectorEmulationAgent_h

#include "core/inspector/InspectorBaseAgent.h"

namespace blink {

class WebLocalFrameImpl;
class WebViewImpl;

class InspectorEmulationAgent final : public InspectorBaseAgent<InspectorEmulationAgent, protocol::Frontend::Emulation>, public protocol::Dispatcher::EmulationCommandHandler {
    WTF_MAKE_NONCOPYABLE(InspectorEmulationAgent);
public:
    class Client {
    public:
        virtual ~Client() {}

        virtual void setCPUThrottlingRate(double rate) {}
    };

    static PassOwnPtrWillBeRawPtr<InspectorEmulationAgent> create(WebLocalFrameImpl*, Client*);
    ~InspectorEmulationAgent() override;

    // protocol::Dispatcher::EmulationCommandHandler implementation.
    void resetPageScaleFactor(ErrorString*) override;
    void setPageScaleFactor(ErrorString*, double in_pageScaleFactor) override;
    void setScriptExecutionDisabled(ErrorString*, bool in_value) override;
    void setTouchEmulationEnabled(ErrorString*, bool in_enabled, const protocol::Maybe<String>& in_configuration) override;
    void setEmulatedMedia(ErrorString*, const String& in_media) override;
    void setCPUThrottlingRate(ErrorString*, double in_rate) override;

    // InspectorBaseAgent overrides.
    void disable(ErrorString*) override;
    void restore() override;

    DECLARE_VIRTUAL_TRACE();

private:
    InspectorEmulationAgent(WebLocalFrameImpl*, Client*);
    WebViewImpl* webViewImpl();

    RawPtrWillBeMember<WebLocalFrameImpl> m_webLocalFrameImpl;
    Client* m_client;
};

} // namespace blink

#endif // !defined(InspectorEmulationAgent_h)