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. 4 5 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_ 7 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 "content/browser/devtools/devtools_protocol.h" 13 14 class SkBitmap; 15 16 namespace content { 17 18 class DevToolsAgentHost; 19 class DevToolsTracingHandler; 20 21 // Overrides Inspector commands before they are sent to the renderer. 22 // May override the implementation completely, ignore it, or handle 23 // additional browser process implementation details. 24 class RendererOverridesHandler : public DevToolsProtocol::Handler { 25 public: 26 explicit RendererOverridesHandler(DevToolsAgentHost* agent); 27 virtual ~RendererOverridesHandler(); 28 29 private: 30 scoped_refptr<DevToolsProtocol::Response> 31 GrantPermissionsForSetFileInputFiles( 32 scoped_refptr<DevToolsProtocol::Command> command); 33 scoped_refptr<DevToolsProtocol::Response> PageHandleJavaScriptDialog( 34 scoped_refptr<DevToolsProtocol::Command> command); 35 scoped_refptr<DevToolsProtocol::Response> PageNavigate( 36 scoped_refptr<DevToolsProtocol::Command> command); 37 scoped_refptr<DevToolsProtocol::Response> PageCaptureScreenshot( 38 scoped_refptr<DevToolsProtocol::Command> command); 39 40 void ScreenshotCaptured( 41 scoped_refptr<DevToolsProtocol::Command> command, 42 const std::string& format, 43 int quality, 44 double scale, 45 bool success, 46 const SkBitmap& bitmap); 47 48 DevToolsAgentHost* agent_; 49 base::WeakPtrFactory<RendererOverridesHandler> weak_factory_; 50 DISALLOW_COPY_AND_ASSIGN(RendererOverridesHandler); 51 }; 52 53 } // namespace content 54 55 #endif // CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_ 56