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
;
24 class BrowserAccessibilityManager
;
25 class RenderWidgetHostImpl
;
26 class RenderWidgetHostInputEventRouter
;
27 struct NativeWebKeyboardEvent
;
30 // RenderWidgetHostDelegate
32 // An interface implemented by an object interested in knowing about the state
33 // of the RenderWidgetHost.
34 class CONTENT_EXPORT RenderWidgetHostDelegate
{
36 // The RenderWidgetHost is going to be deleted.
37 virtual void RenderWidgetDeleted(RenderWidgetHostImpl
* render_widget_host
) {}
39 // The RenderWidgetHost got the focus.
40 virtual void RenderWidgetGotFocus(RenderWidgetHostImpl
* render_widget_host
) {}
42 // The RenderWidget was resized.
43 virtual void RenderWidgetWasResized(RenderWidgetHostImpl
* render_widget_host
,
44 bool width_changed
) {}
46 // The screen info has changed.
47 virtual void ScreenInfoChanged() {}
49 // Callback to give the browser a chance to handle the specified keyboard
50 // event before sending it to the renderer.
51 // Returns true if the |event| was handled. Otherwise, if the |event| would
52 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
53 // |*is_keyboard_shortcut| should be set to true.
54 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent
& event
,
55 bool* is_keyboard_shortcut
);
57 // Callback to inform the browser that the renderer did not process the
58 // specified events. This gives an opportunity to the browser to process the
59 // event (used for keyboard shortcuts).
60 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent
& event
) {}
62 // Callback to inform the browser that the renderer did not process the
63 // specified mouse wheel event. Returns true if the browser has handled
65 virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent
& event
);
67 // Callback to give the browser a chance to handle the specified gesture
68 // event before sending it to the renderer.
69 // Returns true if the |event| was handled.
70 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent
& event
);
72 // Notifies that screen rects were sent to renderer process.
73 virtual void DidSendScreenRects(RenderWidgetHostImpl
* rwh
) {}
75 // Get the root BrowserAccessibilityManager for this frame tree.
76 virtual BrowserAccessibilityManager
* GetRootBrowserAccessibilityManager();
78 // Get the root BrowserAccessibilityManager for this frame tree,
79 // or create it if it doesn't exist.
80 virtual BrowserAccessibilityManager
*
81 GetOrCreateRootBrowserAccessibilityManager();
83 // Send OS Cut/Copy/Paste actions to the focused frame.
84 virtual void Cut() = 0;
85 virtual void Copy() = 0;
86 virtual void Paste() = 0;
87 virtual void SelectAll() = 0;
89 // Requests the renderer to move the selection extent to a new position.
90 virtual void MoveRangeSelectionExtent(const gfx::Point
& extent
) {}
92 // Requests the renderer to select the region between two points in the
93 // currently focused frame.
94 virtual void SelectRange(const gfx::Point
& base
, const gfx::Point
& extent
) {}
96 virtual RenderWidgetHostInputEventRouter
* GetInputEventRouter();
99 virtual gfx::NativeViewAccessible
GetParentNativeViewAccessible();
103 virtual ~RenderWidgetHostDelegate() {}
106 } // namespace content
108 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_