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