Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / render_widget_host_delegate.h
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.
4
5 #ifndef CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_
7
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"
12
13 namespace blink {
14 class WebMouseWheelEvent;
15 class WebGestureEvent;
16 }
17
18 namespace content {
19
20 class BrowserAccessibilityManager;
21 class RenderWidgetHostImpl;
22 struct NativeWebKeyboardEvent;
23
24 //
25 // RenderWidgetHostDelegate
26 //
27 //  An interface implemented by an object interested in knowing about the state
28 //  of the RenderWidgetHost.
29 class CONTENT_EXPORT RenderWidgetHostDelegate {
30  public:
31   // The RenderWidgetHost is going to be deleted.
32   virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {}
33
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);
41
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) {}
46
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
49   // the event itself.
50   virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent& event);
51
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);
56
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);
60
61   // Notifies that screen rects were sent to renderer process.
62   virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {}
63
64   // Notifies that RenderWidgetHost will toggle touch emulation.
65   virtual void OnTouchEmulationEnabled(bool enabled) {}
66
67   // Get the root BrowserAccessibilityManager for this frame tree.
68   virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager();
69
70   // Get the root BrowserAccessibilityManager for this frame tree,
71   // or create it if it doesn't exist.
72   virtual BrowserAccessibilityManager*
73       GetOrCreateRootBrowserAccessibilityManager();
74
75 #if defined(OS_WIN)
76   virtual gfx::NativeViewAccessible GetParentNativeViewAccessible();
77 #endif
78
79  protected:
80   virtual ~RenderWidgetHostDelegate() {}
81 };
82
83 }  // namespace content
84
85 #endif  // CONTENT_BROWSER_RENDER_WIDGET_HOST_DELEGATE_H_