Implement SSLKEYLOGFILE for OpenSSL.
[chromium-blink-merge.git] / content / browser / devtools / renderer_overrides_handler.h
blobb8bf25534c816f7a437e2b6b67083f3d43a8dcba
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted_memory.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
14 #include "cc/output/compositor_frame_metadata.h"
15 #include "content/browser/devtools/devtools_protocol.h"
16 #include "content/common/content_export.h"
17 #include "content/public/browser/render_widget_host.h"
18 #include "third_party/skia/include/core/SkBitmap.h"
20 class SkBitmap;
22 namespace IPC {
23 class Message;
26 namespace blink {
27 class WebMouseEvent;
30 namespace content {
32 class DevToolsTracingHandler;
33 class RenderViewHostImpl;
35 // Overrides Inspector commands before they are sent to the renderer.
36 // May override the implementation completely, ignore it, or handle
37 // additional browser process implementation details.
38 class CONTENT_EXPORT RendererOverridesHandler
39 : public DevToolsProtocol::Handler {
40 public:
41 RendererOverridesHandler();
42 virtual ~RendererOverridesHandler();
44 void OnClientDetached();
45 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata);
46 void OnVisibilityChanged(bool visible);
47 void SetRenderViewHost(RenderViewHostImpl* host);
48 void ClearRenderViewHost();
49 void DidAttachInterstitialPage();
50 void DidDetachInterstitialPage();
52 private:
53 void InnerSwapCompositorFrame();
55 // DOM domain.
56 scoped_refptr<DevToolsProtocol::Response>
57 GrantPermissionsForSetFileInputFiles(
58 scoped_refptr<DevToolsProtocol::Command> command);
60 // Network domain.
61 scoped_refptr<DevToolsProtocol::Response> CanEmulateNetworkConditions(
62 scoped_refptr<DevToolsProtocol::Command> command);
63 scoped_refptr<DevToolsProtocol::Response> ClearBrowserCache(
64 scoped_refptr<DevToolsProtocol::Command> command);
65 scoped_refptr<DevToolsProtocol::Response> ClearBrowserCookies(
66 scoped_refptr<DevToolsProtocol::Command> command);
68 // Page domain.
69 scoped_refptr<DevToolsProtocol::Response> PageEnable(
70 scoped_refptr<DevToolsProtocol::Command> command);
71 scoped_refptr<DevToolsProtocol::Response> PageDisable(
72 scoped_refptr<DevToolsProtocol::Command> command);
73 scoped_refptr<DevToolsProtocol::Response> PageHandleJavaScriptDialog(
74 scoped_refptr<DevToolsProtocol::Command> command);
75 scoped_refptr<DevToolsProtocol::Response> PageNavigate(
76 scoped_refptr<DevToolsProtocol::Command> command);
77 scoped_refptr<DevToolsProtocol::Response> PageReload(
78 scoped_refptr<DevToolsProtocol::Command> command);
79 scoped_refptr<DevToolsProtocol::Response> PageGetNavigationHistory(
80 scoped_refptr<DevToolsProtocol::Command> command);
81 scoped_refptr<DevToolsProtocol::Response> PageNavigateToHistoryEntry(
82 scoped_refptr<DevToolsProtocol::Command> command);
83 scoped_refptr<DevToolsProtocol::Response> PageSetTouchEmulationEnabled(
84 scoped_refptr<DevToolsProtocol::Command> command);
85 scoped_refptr<DevToolsProtocol::Response> PageCaptureScreenshot(
86 scoped_refptr<DevToolsProtocol::Command> command);
87 scoped_refptr<DevToolsProtocol::Response> PageCanEmulate(
88 scoped_refptr<DevToolsProtocol::Command> command);
89 scoped_refptr<DevToolsProtocol::Response> PageCanScreencast(
90 scoped_refptr<DevToolsProtocol::Command> command);
91 scoped_refptr<DevToolsProtocol::Response> PageStartScreencast(
92 scoped_refptr<DevToolsProtocol::Command> command);
93 scoped_refptr<DevToolsProtocol::Response> PageStopScreencast(
94 scoped_refptr<DevToolsProtocol::Command> command);
95 scoped_refptr<DevToolsProtocol::Response> PageQueryUsageAndQuota(
96 scoped_refptr<DevToolsProtocol::Command>);
97 scoped_refptr<DevToolsProtocol::Response> PageSetColorPickerEnabled(
98 scoped_refptr<DevToolsProtocol::Command>);
100 void ScreenshotCaptured(
101 scoped_refptr<DevToolsProtocol::Command> command,
102 const unsigned char* png_data,
103 size_t png_size);
105 void ScreencastFrameCaptured(
106 const std::string& format,
107 int quality,
108 const cc::CompositorFrameMetadata& metadata,
109 bool success,
110 const SkBitmap& bitmap);
112 void PageQueryUsageAndQuotaCompleted(
113 scoped_refptr<DevToolsProtocol::Command>,
114 scoped_ptr<base::DictionaryValue> response_data);
116 void NotifyScreencastVisibility(bool visible);
117 void SetColorPickerEnabled(bool enabled);
118 void UpdateColorPickerFrame();
119 void ResetColorPickerFrame();
120 void ColorPickerFrameUpdated(bool succeeded, const SkBitmap& bitmap);
121 bool HandleMouseEvent(const blink::WebMouseEvent& event);
122 void UpdateColorPickerCursor();
124 // Input domain.
125 scoped_refptr<DevToolsProtocol::Response> InputEmulateTouchFromMouseEvent(
126 scoped_refptr<DevToolsProtocol::Command> command);
128 void UpdateTouchEventEmulationState();
130 RenderViewHostImpl* host_;
131 bool page_domain_enabled_;
132 scoped_refptr<DevToolsProtocol::Command> screencast_command_;
133 bool has_last_compositor_frame_metadata_;
134 cc::CompositorFrameMetadata last_compositor_frame_metadata_;
135 base::TimeTicks last_frame_time_;
136 int capture_retry_count_;
137 bool touch_emulation_enabled_;
138 bool color_picker_enabled_;
139 SkBitmap color_picker_frame_;
140 int last_cursor_x_;
141 int last_cursor_y_;
142 RenderWidgetHost::MouseEventCallback mouse_event_callback_;
143 base::WeakPtrFactory<RendererOverridesHandler> weak_factory_;
144 DISALLOW_COPY_AND_ASSIGN(RendererOverridesHandler);
147 } // namespace content
149 #endif // CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_