| 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_VIEW_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace base { | 26 namespace base { |
| 27 class ListValue; | 27 class ListValue; |
| 28 class TimeTicks; | 28 class TimeTicks; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace IPC { | 31 namespace IPC { |
| 32 class Message; | 32 class Message; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace gfx { | 35 namespace gfx { |
| 36 class Point; | |
| 37 class Rect; | 36 class Rect; |
| 38 class Size; | 37 class Size; |
| 39 } | 38 } |
| 40 | 39 |
| 41 namespace content { | 40 namespace content { |
| 42 | 41 |
| 43 class BrowserContext; | 42 class BrowserContext; |
| 44 class CrossSiteTransferringRequest; | 43 class CrossSiteTransferringRequest; |
| 45 class FrameTree; | 44 class FrameTree; |
| 46 class PageState; | 45 class PageState; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 76 | 75 |
| 77 // This is used to give the delegate a chance to filter IPC messages. | 76 // This is used to give the delegate a chance to filter IPC messages. |
| 78 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 77 virtual bool OnMessageReceived(RenderViewHost* render_view_host, |
| 79 const IPC::Message& message); | 78 const IPC::Message& message); |
| 80 | 79 |
| 81 // Return this object cast to a WebContents, if it is one. If the object is | 80 // Return this object cast to a WebContents, if it is one. If the object is |
| 82 // not a WebContents, returns NULL. DEPRECATED: Be sure to include brettw or | 81 // not a WebContents, returns NULL. DEPRECATED: Be sure to include brettw or |
| 83 // jam as reviewers before you use this method. http://crbug.com/82582 | 82 // jam as reviewers before you use this method. http://crbug.com/82582 |
| 84 virtual WebContents* GetAsWebContents(); | 83 virtual WebContents* GetAsWebContents(); |
| 85 | 84 |
| 86 // Return the rect where to display the resize corner, if any, otherwise | |
| 87 // an empty rect. | |
| 88 virtual gfx::Rect GetRootWindowResizerRect() const = 0; | |
| 89 | |
| 90 // The RenderView is being constructed (message sent to the renderer process | 85 // The RenderView is being constructed (message sent to the renderer process |
| 91 // to construct a RenderView). Now is a good time to send other setup events | 86 // to construct a RenderView). Now is a good time to send other setup events |
| 92 // to the RenderView. This precedes any other commands to the RenderView. | 87 // to the RenderView. This precedes any other commands to the RenderView. |
| 93 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} | 88 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} |
| 94 | 89 |
| 95 // The RenderView has been constructed. | 90 // The RenderView has been constructed. |
| 96 virtual void RenderViewReady(RenderViewHost* render_view_host) {} | 91 virtual void RenderViewReady(RenderViewHost* render_view_host) {} |
| 97 | 92 |
| 98 // The process containing the RenderView exited somehow (either cleanly, | 93 // The process containing the RenderView exited somehow (either cleanly, |
| 99 // crash, or user kill). | 94 // crash, or user kill). |
| (...skipping 28 matching lines...) Expand all Loading... |
| 128 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) {} | 123 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) {} |
| 129 | 124 |
| 130 // The page wants to close the active view in this tab. | 125 // The page wants to close the active view in this tab. |
| 131 virtual void RouteCloseEvent(RenderViewHost* rvh) {} | 126 virtual void RouteCloseEvent(RenderViewHost* rvh) {} |
| 132 | 127 |
| 133 // Return a dummy RendererPreferences object that will be used by the renderer | 128 // Return a dummy RendererPreferences object that will be used by the renderer |
| 134 // associated with the owning RenderViewHost. | 129 // associated with the owning RenderViewHost. |
| 135 virtual RendererPreferences GetRendererPrefs( | 130 virtual RendererPreferences GetRendererPrefs( |
| 136 BrowserContext* browser_context) const = 0; | 131 BrowserContext* browser_context) const = 0; |
| 137 | 132 |
| 138 // Notification the user has made a gesture while focus was on the | |
| 139 // page. This is used to avoid uninitiated user downloads (aka carpet | |
| 140 // bombing), see DownloadRequestLimiter for details. | |
| 141 virtual void OnUserGesture() {} | |
| 142 | |
| 143 // Notification from the renderer host that blocked UI event occurred. | 133 // Notification from the renderer host that blocked UI event occurred. |
| 144 // This happens when there are tab-modal dialogs. In this case, the | 134 // This happens when there are tab-modal dialogs. In this case, the |
| 145 // notification is needed to let us draw attention to the dialog (i.e. | 135 // notification is needed to let us draw attention to the dialog (i.e. |
| 146 // refocus on the modal dialog, flash title etc). | 136 // refocus on the modal dialog, flash title etc). |
| 147 virtual void OnIgnoredUIEvent() {} | 137 virtual void OnIgnoredUIEvent() {} |
| 148 | 138 |
| 149 // Notification that the renderer has become unresponsive. The | |
| 150 // delegate can use this notification to show a warning to the user. | |
| 151 virtual void RendererUnresponsive(RenderViewHost* render_view_host) {} | |
| 152 | |
| 153 // Notification that a previously unresponsive renderer has become | |
| 154 // responsive again. The delegate can use this notification to end the | |
| 155 // warning shown to the user. | |
| 156 virtual void RendererResponsive(RenderViewHost* render_view_host) {} | |
| 157 | |
| 158 // Notification that the RenderViewHost's load state changed. | 139 // Notification that the RenderViewHost's load state changed. |
| 159 virtual void LoadStateChanged(const GURL& url, | 140 virtual void LoadStateChanged(const GURL& url, |
| 160 const net::LoadStateWithParam& load_state, | 141 const net::LoadStateWithParam& load_state, |
| 161 uint64 upload_position, | 142 uint64 upload_position, |
| 162 uint64 upload_size) {} | 143 uint64 upload_size) {} |
| 163 | 144 |
| 164 // The page wants the hosting window to activate itself (it called the | 145 // The page wants the hosting window to activate itself (it called the |
| 165 // JavaScript window.focus() method). | 146 // JavaScript window.focus() method). |
| 166 virtual void Activate() {} | 147 virtual void Activate() {} |
| 167 | 148 |
| 168 // Notification that the view has lost capture. | 149 // Notification that the view has lost capture. |
| 169 virtual void LostCapture() {} | 150 virtual void LostCapture() {} |
| 170 | 151 |
| 171 // Called when a file selection is to be done. | 152 // Called when a file selection is to be done. |
| 172 virtual void RunFileChooser( | 153 virtual void RunFileChooser( |
| 173 RenderViewHost* render_view_host, | 154 RenderViewHost* render_view_host, |
| 174 const FileChooserParams& params) {} | 155 const FileChooserParams& params) {} |
| 175 | 156 |
| 176 // Returns whether the associated tab is in fullscreen mode. | 157 // Returns whether the associated tab is in fullscreen mode. |
| 177 virtual bool IsFullscreenForCurrentTab() const; | 158 virtual bool IsFullscreenForCurrentTab() const; |
| 178 | 159 |
| 179 // Returns the display mode for the view. | 160 // Returns the display mode for the view. |
| 180 virtual blink::WebDisplayMode GetDisplayMode() const; | 161 virtual blink::WebDisplayMode GetDisplayMode() const; |
| 181 | 162 |
| 182 // The contents' preferred size changed. | 163 // The contents' preferred size changed. |
| 183 virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} | 164 virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} |
| 184 | 165 |
| 185 // The contents auto-resized and the container should match it. | |
| 186 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) {} | |
| 187 | |
| 188 // Requests to lock the mouse. Once the request is approved or rejected, | |
| 189 // GotResponseToLockMouseRequest() will be called on the requesting render | |
| 190 // view host. | |
| 191 virtual void RequestToLockMouse(bool user_gesture, | |
| 192 bool last_unlocked_by_target) {} | |
| 193 | |
| 194 // Notification that the view has lost the mouse lock. | 166 // Notification that the view has lost the mouse lock. |
| 195 virtual void LostMouseLock() {} | 167 virtual void LostMouseLock() {} |
| 196 | 168 |
| 197 // The page is trying to open a new page (e.g. a popup window). The window | 169 // The page is trying to open a new page (e.g. a popup window). The window |
| 198 // should be created associated with the given |route_id| in the process of | 170 // should be created associated with the given |route_id| in the process of |
| 199 // |source_site_instance|, but it should not be shown yet. That | 171 // |source_site_instance|, but it should not be shown yet. That |
| 200 // should happen in response to ShowCreatedWindow. | 172 // should happen in response to ShowCreatedWindow. |
| 201 // |params.window_container_type| describes the type of RenderViewHost | 173 // |params.window_container_type| describes the type of RenderViewHost |
| 202 // container that is requested -- in particular, the window.open call may | 174 // container that is requested -- in particular, the window.open call may |
| 203 // have specified 'background' and 'persistent' in the feature string. | 175 // have specified 'background' and 'persistent' in the feature string. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 virtual void SetIsVirtualKeyboardRequested(bool requested) {} | 249 virtual void SetIsVirtualKeyboardRequested(bool requested) {} |
| 278 virtual bool IsVirtualKeyboardRequested(); | 250 virtual bool IsVirtualKeyboardRequested(); |
| 279 | 251 |
| 280 protected: | 252 protected: |
| 281 virtual ~RenderViewHostDelegate() {} | 253 virtual ~RenderViewHostDelegate() {} |
| 282 }; | 254 }; |
| 283 | 255 |
| 284 } // namespace content | 256 } // namespace content |
| 285 | 257 |
| 286 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 258 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| OLD | NEW |