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 "base/basictypes.h"
9 #include "build/build_config.h"
10 #include "content/common/content_export.h"
11 #include "ui/gfx/native_widget_types.h"
14 class WebMouseWheelEvent;
15 class WebGestureEvent;
20 class BrowserAccessibilityManager;
21 class RenderWidgetHostImpl;
22 struct NativeWebKeyboardEvent;
25 // RenderWidgetHostDelegate
27 // An interface implemented by an object interested in knowing about the state
28 // of the RenderWidgetHost.
29 class CONTENT_EXPORT RenderWidgetHostDelegate {
31 // The RenderWidgetHost is going to be deleted.
32 virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {}
34 // Callback to give the browser a chance to handle the specified keyboard
35 // event before sending it to the renderer.
36 // Returns true if the |event| was handled. Otherwise, if the |event| would
37 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
38 // |*is_keyboard_shortcut| should be set to true.
39 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
40 bool* is_keyboard_shortcut);
42 // Callback to inform the browser that the renderer did not process the
43 // specified events. This gives an opportunity to the browser to process the
44 // event (used for keyboard shortcuts).
45 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
47 // Callback to inform the browser that the renderer did not process the
48 // specified mouse wheel event. Returns true if the browser has handled
50 virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent& event);
52 // Callback to give the browser a chance to handle the specified gesture
53 // event before sending it to the renderer.
54 // Returns true if the |event| was handled.
55 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event);
57 // Callback to inform the browser that the renderer did not process the
58 // specified gesture event. Returns true if the |event| was handled.
59 virtual bool HandleGestureEvent(const blink::WebGestureEvent& event);
61 // Notifies that screen rects were sent to renderer process.
62 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {}
64 // Notifies that RenderWidgetHost will toggle touch emulation.
65 virtual void OnTouchEmulationEnabled(bool enabled) {}
67 // Get the root BrowserAccessibilityManager for this frame tree.
68 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager();
70 // Get the root BrowserAccessibilityManager for this frame tree,
71 // or create it if it doesn't exist.
72 virtual BrowserAccessibilityManager*
73 GetOrCreateRootBrowserAccessibilityManager();
76 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible();
80 virtual ~RenderWidgetHostDelegate() {}
83 } // namespace content
85 #endif // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_