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
;
18 class RenderWidgetHostImpl
;
19 struct NativeWebKeyboardEvent
;
22 // RenderWidgetHostDelegate
24 // An interface implemented by an object interested in knowing about the state
25 // of the RenderWidgetHost.
26 class CONTENT_EXPORT RenderWidgetHostDelegate
{
28 // The RenderWidgetHost is going to be deleted.
29 virtual void RenderWidgetDeleted(RenderWidgetHostImpl
* render_widget_host
) {}
31 // Callback to give the browser a chance to handle the specified keyboard
32 // event before sending it to the renderer.
33 // Returns true if the |event| was handled. Otherwise, if the |event| would
34 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
35 // |*is_keyboard_shortcut| should be set to true.
36 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent
& event
,
37 bool* is_keyboard_shortcut
);
39 // Callback to inform the browser that the renderer did not process the
40 // specified events. This gives an opportunity to the browser to process the
41 // event (used for keyboard shortcuts).
42 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent
& event
) {}
44 // Callback to give the browser a chance to handle the specified mouse wheel
45 // event before sending it to the renderer.
46 // Returns true if the |event| was handled.
47 virtual bool PreHandleWheelEvent(const blink::WebMouseWheelEvent
& event
);
49 // Notifies that screen rects were sent to renderer process.
50 virtual void DidSendScreenRects(RenderWidgetHostImpl
* rwh
) {}
52 #if defined(OS_WIN) && defined(USE_AURA)
53 // Returns the widget's parent's NativeViewAccessible.
54 virtual gfx::NativeViewAccessible
GetParentNativeViewAccessible();
58 virtual ~RenderWidgetHostDelegate() {}
61 } // namespace content
63 #endif // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_