OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "third_party/WebKit/public/web/WebInputEvent.h" | 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 class WebMouseWheelEvent; | 15 class WebMouseWheelEvent; |
16 class WebGestureEvent; | 16 class WebGestureEvent; |
17 } | 17 } |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 class Point; | 20 class Point; |
| 21 class Rect; |
| 22 class Size; |
21 } | 23 } |
22 | 24 |
23 namespace content { | 25 namespace content { |
24 | 26 |
25 class BrowserAccessibilityManager; | 27 class BrowserAccessibilityManager; |
26 class RenderWidgetHostImpl; | 28 class RenderWidgetHostImpl; |
27 class RenderWidgetHostInputEventRouter; | 29 class RenderWidgetHostInputEventRouter; |
28 struct NativeWebKeyboardEvent; | 30 struct NativeWebKeyboardEvent; |
29 | 31 |
30 // | 32 // |
31 // RenderWidgetHostDelegate | 33 // RenderWidgetHostDelegate |
32 // | 34 // |
33 // An interface implemented by an object interested in knowing about the state | 35 // An interface implemented by an object interested in knowing about the state |
34 // of the RenderWidgetHost. | 36 // of the RenderWidgetHost. |
35 class CONTENT_EXPORT RenderWidgetHostDelegate { | 37 class CONTENT_EXPORT RenderWidgetHostDelegate { |
36 public: | 38 public: |
37 // The RenderWidgetHost is going to be deleted. | 39 // The RenderWidgetHost is going to be deleted. |
38 virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {} | 40 virtual void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) {} |
39 | 41 |
40 // The RenderWidgetHost got the focus. | 42 // The RenderWidgetHost got the focus. |
41 virtual void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) {} | 43 virtual void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) {} |
42 | 44 |
43 // The RenderWidget was resized. | 45 // The RenderWidget was resized. |
44 virtual void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host, | 46 virtual void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host, |
45 bool width_changed) {} | 47 bool width_changed) {} |
46 | 48 |
| 49 // The contents auto-resized and the container should match it. |
| 50 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) {} |
| 51 |
47 // The screen info has changed. | 52 // The screen info has changed. |
48 virtual void ScreenInfoChanged() {} | 53 virtual void ScreenInfoChanged() {} |
49 | 54 |
50 // Callback to give the browser a chance to handle the specified keyboard | 55 // Callback to give the browser a chance to handle the specified keyboard |
51 // event before sending it to the renderer. | 56 // event before sending it to the renderer. |
52 // Returns true if the |event| was handled. Otherwise, if the |event| would | 57 // Returns true if the |event| was handled. Otherwise, if the |event| would |
53 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, | 58 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, |
54 // |*is_keyboard_shortcut| should be set to true. | 59 // |*is_keyboard_shortcut| should be set to true. |
55 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 60 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
56 bool* is_keyboard_shortcut); | 61 bool* is_keyboard_shortcut); |
(...skipping 11 matching lines...) Expand all Loading... |
68 // Notification the user has performed a direct interaction (mouse down, raw | 73 // Notification the user has performed a direct interaction (mouse down, raw |
69 // key down, or gesture tap) while focus was on the page. This is used to | 74 // key down, or gesture tap) while focus was on the page. This is used to |
70 // inform the delegate that a user is interacting with a site. | 75 // inform the delegate that a user is interacting with a site. |
71 virtual void OnUserInteraction(const blink::WebInputEvent::Type type) {} | 76 virtual void OnUserInteraction(const blink::WebInputEvent::Type type) {} |
72 | 77 |
73 // Callback to give the browser a chance to handle the specified gesture | 78 // Callback to give the browser a chance to handle the specified gesture |
74 // event before sending it to the renderer. | 79 // event before sending it to the renderer. |
75 // Returns true if the |event| was handled. | 80 // Returns true if the |event| was handled. |
76 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event); | 81 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event); |
77 | 82 |
| 83 // Notification the user has made a gesture while focus was on the |
| 84 // page. This is used to avoid uninitiated user downloads (aka carpet |
| 85 // bombing), see DownloadRequestLimiter for details. |
| 86 virtual void OnUserGesture() {} |
| 87 |
78 // Notifies that screen rects were sent to renderer process. | 88 // Notifies that screen rects were sent to renderer process. |
79 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {} | 89 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {} |
80 | 90 |
81 // Get the root BrowserAccessibilityManager for this frame tree. | 91 // Get the root BrowserAccessibilityManager for this frame tree. |
82 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager(); | 92 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager(); |
83 | 93 |
84 // Get the root BrowserAccessibilityManager for this frame tree, | 94 // Get the root BrowserAccessibilityManager for this frame tree, |
85 // or create it if it doesn't exist. | 95 // or create it if it doesn't exist. |
86 virtual BrowserAccessibilityManager* | 96 virtual BrowserAccessibilityManager* |
87 GetOrCreateRootBrowserAccessibilityManager(); | 97 GetOrCreateRootBrowserAccessibilityManager(); |
(...skipping 10 matching lines...) Expand all Loading... |
98 // Requests the renderer to select the region between two points in the | 108 // Requests the renderer to select the region between two points in the |
99 // currently focused frame. | 109 // currently focused frame. |
100 virtual void SelectRange(const gfx::Point& base, const gfx::Point& extent) {} | 110 virtual void SelectRange(const gfx::Point& base, const gfx::Point& extent) {} |
101 | 111 |
102 virtual RenderWidgetHostInputEventRouter* GetInputEventRouter(); | 112 virtual RenderWidgetHostInputEventRouter* GetInputEventRouter(); |
103 | 113 |
104 // Send page-level focus state to all SiteInstances involved in rendering the | 114 // Send page-level focus state to all SiteInstances involved in rendering the |
105 // current FrameTree, not including the main frame's SiteInstance. | 115 // current FrameTree, not including the main frame's SiteInstance. |
106 virtual void ReplicatePageFocus(bool is_focused) {} | 116 virtual void ReplicatePageFocus(bool is_focused) {} |
107 | 117 |
| 118 // Notification that the renderer has become unresponsive. The |
| 119 // delegate can use this notification to show a warning to the user. |
| 120 virtual void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) {} |
| 121 |
| 122 // Notification that a previously unresponsive renderer has become |
| 123 // responsive again. The delegate can use this notification to end the |
| 124 // warning shown to the user. |
| 125 virtual void RendererResponsive(RenderWidgetHostImpl* render_widget_host) {} |
| 126 |
| 127 // Requests to lock the mouse. Once the request is approved or rejected, |
| 128 // GotResponseToLockMouseRequest() will be called on the requesting render |
| 129 // widget host. |
| 130 virtual void RequestToLockMouse(bool user_gesture, |
| 131 bool last_unlocked_by_target) {} |
| 132 |
| 133 // Return the rect where to display the resize corner, if any, otherwise |
| 134 // an empty rect. |
| 135 virtual gfx::Rect GetRootWindowResizerRect() const; |
| 136 |
108 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
109 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible(); | 138 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible(); |
110 #endif | 139 #endif |
111 | 140 |
112 protected: | 141 protected: |
113 virtual ~RenderWidgetHostDelegate() {} | 142 virtual ~RenderWidgetHostDelegate() {} |
114 }; | 143 }; |
115 | 144 |
116 } // namespace content | 145 } // namespace content |
117 | 146 |
118 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ | 147 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ |
OLD | NEW |