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"
13 class WebMouseWheelEvent
;
14 class WebGestureEvent
;
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
{
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
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
) {}
63 // Returns the widget's parent's NativeViewAccessible.
64 virtual gfx::NativeViewAccessible
GetParentNativeViewAccessible();
68 virtual ~RenderWidgetHostDelegate() {}
71 } // namespace content
73 #endif // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_