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/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h"
13 #include "cc/output/compositor_frame_metadata.h"
14 #include "content/browser/devtools/devtools_protocol.h"
24 class DevToolsAgentHost
;
25 class DevToolsTracingHandler
;
27 // Overrides Inspector commands before they are sent to the renderer.
28 // May override the implementation completely, ignore it, or handle
29 // additional browser process implementation details.
30 class RendererOverridesHandler
: public DevToolsProtocol::Handler
{
32 explicit RendererOverridesHandler(DevToolsAgentHost
* agent
);
33 virtual ~RendererOverridesHandler();
35 void OnClientDetached();
36 void OnSwapCompositorFrame(const IPC::Message
& message
);
37 void OnVisibilityChanged(bool visible
);
40 void InnerSwapCompositorFrame();
41 void ParseCaptureParameters(DevToolsProtocol::Command
* command
,
42 std::string
* format
, int* quality
,
46 scoped_refptr
<DevToolsProtocol::Response
>
47 GrantPermissionsForSetFileInputFiles(
48 scoped_refptr
<DevToolsProtocol::Command
> command
);
51 scoped_refptr
<DevToolsProtocol::Response
> PageDisable(
52 scoped_refptr
<DevToolsProtocol::Command
> command
);
53 scoped_refptr
<DevToolsProtocol::Response
> PageHandleJavaScriptDialog(
54 scoped_refptr
<DevToolsProtocol::Command
> command
);
55 scoped_refptr
<DevToolsProtocol::Response
> PageNavigate(
56 scoped_refptr
<DevToolsProtocol::Command
> command
);
57 scoped_refptr
<DevToolsProtocol::Response
> PageReload(
58 scoped_refptr
<DevToolsProtocol::Command
> command
);
59 scoped_refptr
<DevToolsProtocol::Response
> PageGetNavigationHistory(
60 scoped_refptr
<DevToolsProtocol::Command
> command
);
61 scoped_refptr
<DevToolsProtocol::Response
> PageNavigateToHistoryEntry(
62 scoped_refptr
<DevToolsProtocol::Command
> command
);
63 scoped_refptr
<DevToolsProtocol::Response
> PageCaptureScreenshot(
64 scoped_refptr
<DevToolsProtocol::Command
> command
);
65 scoped_refptr
<DevToolsProtocol::Response
> PageStartScreencast(
66 scoped_refptr
<DevToolsProtocol::Command
> command
);
67 scoped_refptr
<DevToolsProtocol::Response
> PageStopScreencast(
68 scoped_refptr
<DevToolsProtocol::Command
> command
);
70 void ScreenshotCaptured(
71 scoped_refptr
<DevToolsProtocol::Command
> command
,
72 const std::string
& format
,
74 const cc::CompositorFrameMetadata
& metadata
,
76 const SkBitmap
& bitmap
);
78 void NotifyScreencastVisibility(bool visible
);
81 scoped_refptr
<DevToolsProtocol::Response
> InputDispatchMouseEvent(
82 scoped_refptr
<DevToolsProtocol::Command
> command
);
83 scoped_refptr
<DevToolsProtocol::Response
> InputDispatchGestureEvent(
84 scoped_refptr
<DevToolsProtocol::Command
> command
);
86 DevToolsAgentHost
* agent_
;
87 base::WeakPtrFactory
<RendererOverridesHandler
> weak_factory_
;
88 scoped_refptr
<DevToolsProtocol::Command
> screencast_command_
;
89 cc::CompositorFrameMetadata last_compositor_frame_metadata_
;
90 base::TimeTicks last_frame_time_
;
91 DISALLOW_COPY_AND_ASSIGN(RendererOverridesHandler
);
94 } // namespace content
96 #endif // CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_