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_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_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 // The RenderWidgetHost got the focus.
35 virtual void RenderWidgetGotFocus(RenderWidgetHostImpl
* render_widget_host
) {}
37 // The RenderWidget was resized.
38 virtual void RenderWidgetWasResized(RenderWidgetHostImpl
* render_widget_host
,
39 bool width_changed
) {}
41 // The screen info has changed.
42 virtual void ScreenInfoChanged() {}
44 // Callback to give the browser a chance to handle the specified keyboard
45 // event before sending it to the renderer.
46 // Returns true if the |event| was handled. Otherwise, if the |event| would
47 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
48 // |*is_keyboard_shortcut| should be set to true.
49 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent
& event
,
50 bool* is_keyboard_shortcut
);
52 // Callback to inform the browser that the renderer did not process the
53 // specified events. This gives an opportunity to the browser to process the
54 // event (used for keyboard shortcuts).
55 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent
& event
) {}
57 // Callback to inform the browser that the renderer did not process the
58 // specified mouse wheel event. Returns true if the browser has handled
60 virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent
& event
);
62 // Callback to give the browser a chance to handle the specified gesture
63 // event before sending it to the renderer.
64 // Returns true if the |event| was handled.
65 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent
& event
);
67 // Notifies that screen rects were sent to renderer process.
68 virtual void DidSendScreenRects(RenderWidgetHostImpl
* rwh
) {}
70 // Get the root BrowserAccessibilityManager for this frame tree.
71 virtual BrowserAccessibilityManager
* GetRootBrowserAccessibilityManager();
73 // Get the root BrowserAccessibilityManager for this frame tree,
74 // or create it if it doesn't exist.
75 virtual BrowserAccessibilityManager
*
76 GetOrCreateRootBrowserAccessibilityManager();
79 virtual gfx::NativeViewAccessible
GetParentNativeViewAccessible();
83 virtual ~RenderWidgetHostDelegate() {}
86 } // namespace content
88 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_