Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_delegate.h
blob983f2824cd8a7a53f38c73ab734a59679843fe33
1 // Copyright (c) 2012 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_RENDER_WIDGET_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
8 #include "build/build_config.h"
9 #include "content/common/content_export.h"
10 #include "ui/gfx/native_widget_types.h"
12 namespace blink {
13 class WebMouseWheelEvent;
14 class WebGestureEvent;
17 namespace content {
19 class RenderWidgetHostImpl;
20 struct NativeWebKeyboardEvent;
23 // RenderWidgetHostDelegate
25 // An interface implemented by an object interested in knowing about the state
26 // of the RenderWidgetHost.
27 class CONTENT_EXPORT RenderWidgetHostDelegate {
28 public:
29 // The RenderWidgetHost is going to be deleted.
30 virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {}
32 // Callback to give the browser a chance to handle the specified keyboard
33 // event before sending it to the renderer.
34 // Returns true if the |event| was handled. Otherwise, if the |event| would
35 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
36 // |*is_keyboard_shortcut| should be set to true.
37 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
38 bool* is_keyboard_shortcut);
40 // Callback to inform the browser that the renderer did not process the
41 // specified events. This gives an opportunity to the browser to process the
42 // event (used for keyboard shortcuts).
43 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
45 // Callback to inform the browser that the renderer did not process the
46 // specified mouse wheel event. Returns true if the browser has handled
47 // the event itself.
48 virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent& event);
50 // Callback to give the browser a chance to handle the specified gesture
51 // event before sending it to the renderer.
52 // Returns true if the |event| was handled.
53 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event);
55 // Callback to inform the browser that the renderer did not process the
56 // specified gesture event. Returns true if the |event| was handled.
57 virtual bool HandleGestureEvent(const blink::WebGestureEvent& event);
59 // Notifies that screen rects were sent to renderer process.
60 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {}
62 #if defined(OS_WIN)
63 // Returns the widget's parent's NativeViewAccessible.
64 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible();
65 #endif
67 protected:
68 virtual ~RenderWidgetHostDelegate() {}
71 } // namespace content
73 #endif // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_