Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: content/browser/renderer_host/render_widget_host_delegate.h

Issue 1410313006: Separate RenderViewHost from RenderWidgetHost, part 5: move calls to the RenderWidgetHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(RenderWidgetHostImpl* render_widget_host,
51 const gfx::Size& new_size) {}
52
47 // The screen info has changed. 53 // The screen info has changed.
48 virtual void ScreenInfoChanged() {} 54 virtual void ScreenInfoChanged() {}
49 55
50 // Callback to give the browser a chance to handle the specified keyboard 56 // Callback to give the browser a chance to handle the specified keyboard
51 // event before sending it to the renderer. 57 // event before sending it to the renderer.
52 // Returns true if the |event| was handled. Otherwise, if the |event| would 58 // Returns true if the |event| was handled. Otherwise, if the |event| would
53 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, 59 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
54 // |*is_keyboard_shortcut| should be set to true. 60 // |*is_keyboard_shortcut| should be set to true.
55 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 61 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
56 bool* is_keyboard_shortcut); 62 bool* is_keyboard_shortcut);
(...skipping 12 matching lines...) Expand all
69 // wheel, raw key down, or gesture tap) while focus was on the page. Informs 75 // wheel, raw key down, or gesture tap) while focus was on the page. Informs
70 // the delegate that a user is interacting with a site. Only the first mouse 76 // the delegate that a user is interacting with a site. Only the first mouse
71 // wheel event during a scroll will trigger this method. 77 // wheel event during a scroll will trigger this method.
72 virtual void OnUserInteraction(const blink::WebInputEvent::Type type) {} 78 virtual void OnUserInteraction(const blink::WebInputEvent::Type type) {}
73 79
74 // Callback to give the browser a chance to handle the specified gesture 80 // Callback to give the browser a chance to handle the specified gesture
75 // event before sending it to the renderer. 81 // event before sending it to the renderer.
76 // Returns true if the |event| was handled. 82 // Returns true if the |event| was handled.
77 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event); 83 virtual bool PreHandleGestureEvent(const blink::WebGestureEvent& event);
78 84
85 // Notification the user has made a gesture while focus was on the
86 // page. This is used to avoid uninitiated user downloads (aka carpet
87 // bombing), see DownloadRequestLimiter for details.
88 virtual void OnUserGesture(RenderWidgetHostImpl* render_widget_host) {}
89
79 // Notifies that screen rects were sent to renderer process. 90 // Notifies that screen rects were sent to renderer process.
80 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {} 91 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) {}
81 92
82 // Get the root BrowserAccessibilityManager for this frame tree. 93 // Get the root BrowserAccessibilityManager for this frame tree.
83 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager(); 94 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager();
84 95
85 // Get the root BrowserAccessibilityManager for this frame tree, 96 // Get the root BrowserAccessibilityManager for this frame tree,
86 // or create it if it doesn't exist. 97 // or create it if it doesn't exist.
87 virtual BrowserAccessibilityManager* 98 virtual BrowserAccessibilityManager*
88 GetOrCreateRootBrowserAccessibilityManager(); 99 GetOrCreateRootBrowserAccessibilityManager();
(...skipping 16 matching lines...) Expand all
105 // Send page-level focus state to all SiteInstances involved in rendering the 116 // Send page-level focus state to all SiteInstances involved in rendering the
106 // current FrameTree, not including the main frame's SiteInstance. 117 // current FrameTree, not including the main frame's SiteInstance.
107 virtual void ReplicatePageFocus(bool is_focused) {} 118 virtual void ReplicatePageFocus(bool is_focused) {}
108 119
109 // Get the RenderWidgetHost of the currently focused frame. With 120 // Get the RenderWidgetHost of the currently focused frame. With
110 // out-of-process iframes, multiple RenderWidgetHosts may be involved in 121 // out-of-process iframes, multiple RenderWidgetHosts may be involved in
111 // rendering a page, and this function determines which RenderWidgetHost 122 // rendering a page, and this function determines which RenderWidgetHost
112 // should consume a keyboard input event. 123 // should consume a keyboard input event.
113 virtual RenderWidgetHostImpl* GetFocusedRenderWidgetHost(); 124 virtual RenderWidgetHostImpl* GetFocusedRenderWidgetHost();
114 125
126 // Notification that the renderer has become unresponsive. The
127 // delegate can use this notification to show a warning to the user.
128 virtual void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) {}
129
130 // Notification that a previously unresponsive renderer has become
131 // responsive again. The delegate can use this notification to end the
132 // warning shown to the user.
133 virtual void RendererResponsive(RenderWidgetHostImpl* render_widget_host) {}
134
135 // Requests to lock the mouse. Once the request is approved or rejected,
136 // GotResponseToLockMouseRequest() will be called on the requesting render
137 // widget host.
138 virtual void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host,
139 bool user_gesture,
140 bool last_unlocked_by_target) {}
141
142 // Return the rect where to display the resize corner, if any, otherwise
143 // an empty rect.
144 virtual gfx::Rect GetRootWindowResizerRect(
145 RenderWidgetHostImpl* render_widget_host) const;
146
115 #if defined(OS_WIN) 147 #if defined(OS_WIN)
116 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible(); 148 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible();
117 #endif 149 #endif
118 150
119 protected: 151 protected:
120 virtual ~RenderWidgetHostDelegate() {} 152 virtual ~RenderWidgetHostDelegate() {}
121 }; 153 };
122 154
123 } // namespace content 155 } // namespace content
124 156
125 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_ 157 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/renderer_host/render_widget_host_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698