OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // RenderViewHost. This is called when a pending RenderViewHost is created | 156 // RenderViewHost. This is called when a pending RenderViewHost is created |
157 // for a cross-site navigation, because we must suspend any navigations until | 157 // for a cross-site navigation, because we must suspend any navigations until |
158 // we hear back from the old renderer's onbeforeunload handler. Note that it | 158 // we hear back from the old renderer's onbeforeunload handler. Note that it |
159 // is important that only one navigation event happen after calling this | 159 // is important that only one navigation event happen after calling this |
160 // method with |suspend| equal to true. If |suspend| is false and there is | 160 // method with |suspend| equal to true. If |suspend| is false and there is |
161 // a suspended_nav_message_, this will send the message. This function | 161 // a suspended_nav_message_, this will send the message. This function |
162 // should only be called to toggle the state; callers should check | 162 // should only be called to toggle the state; callers should check |
163 // are_navigations_suspended() first. | 163 // are_navigations_suspended() first. |
164 void SetNavigationsSuspended(bool suspend); | 164 void SetNavigationsSuspended(bool suspend); |
165 | 165 |
| 166 // Clears any suspended navigation state after a cross-site navigation is |
| 167 // canceled or suspended. This is important if we later return to this |
| 168 // RenderViewHost. |
| 169 void CancelSuspendedNavigations(); |
| 170 |
| 171 // Whether this RenderViewHost has been swapped out to be displayed by a |
| 172 // different process. |
| 173 bool is_swapped_out() const { return is_swapped_out_; } |
| 174 |
166 // Causes the renderer to invoke the onbeforeunload event handler. The | 175 // Causes the renderer to invoke the onbeforeunload event handler. The |
167 // result will be returned via ViewMsg_ShouldClose. See also ClosePage which | 176 // result will be returned via ViewMsg_ShouldClose. See also ClosePage and |
168 // will fire the PageUnload event. | 177 // SwapOut, which fire the PageUnload event. |
169 // | 178 // |
170 // Set bool for_cross_site_transition when this close is just for the current | 179 // Set bool for_cross_site_transition when this close is just for the current |
171 // RenderView in the case of a cross-site transition. False means we're | 180 // RenderView in the case of a cross-site transition. False means we're |
172 // closing the entire tab. | 181 // closing the entire tab. |
173 void FirePageBeforeUnload(bool for_cross_site_transition); | 182 void FirePageBeforeUnload(bool for_cross_site_transition); |
174 | 183 |
| 184 // Tells the renderer that this RenderView is being swapped out for one in a |
| 185 // different renderer process. It should run its unload handler and move to |
| 186 // a blank document. The renderer should preserve the Frame object until it |
| 187 // exits, in case we come back. The renderer can exit if it has no other |
| 188 // active RenderViews, but not until WasSwappedOut is called (when it is no |
| 189 // longer visible). |
| 190 // |
| 191 // Please see ViewMsg_SwapOut_Params in view_messages.h for a description |
| 192 // of the parameters. |
| 193 void SwapOut(int new_render_process_host_id, int new_request_id); |
| 194 |
| 195 // Called by ResourceDispatcherHost after the SwapOutACK is received. |
| 196 void OnSwapOutACK(); |
| 197 |
| 198 // Called to notify the renderer that it has been visibly swapped out and |
| 199 // replaced by another RenderViewHost, after an earlier call to SwapOut. |
| 200 // It is now safe for the process to exit if there are no other active |
| 201 // RenderViews. |
| 202 void WasSwappedOut(); |
| 203 |
175 // Causes the renderer to close the current page, including running its | 204 // Causes the renderer to close the current page, including running its |
176 // onunload event handler. A ClosePage_ACK message will be sent to the | 205 // onunload event handler. A ClosePage_ACK message will be sent to the |
177 // ResourceDispatcherHost when it is finished. | 206 // ResourceDispatcherHost when it is finished. |
178 // | 207 void ClosePage(); |
179 // Please see ViewMsg_ClosePage in resource_messages_internal.h for a | |
180 // description of the parameters. | |
181 void ClosePage(bool for_cross_site_transition, | |
182 int new_render_process_host_id, | |
183 int new_request_id); | |
184 | |
185 // Called by ResourceDispatcherHost after the ClosePageACK is received. | |
186 void OnClosePageACK(bool for_cross_site_transition); | |
187 | 208 |
188 // Close the page ignoring whether it has unload events registers. | 209 // Close the page ignoring whether it has unload events registers. |
189 // This is called after the beforeunload and unload events have fired | 210 // This is called after the beforeunload and unload events have fired |
190 // and the user has agreed to continue with closing the page. | 211 // and the user has agreed to continue with closing the page. |
191 void ClosePageIgnoringUnloadEvents(); | 212 void ClosePageIgnoringUnloadEvents(); |
192 | 213 |
193 // Sets whether this RenderViewHost has an outstanding cross-site request, | 214 // Sets whether this RenderViewHost has an outstanding cross-site request, |
194 // for which another renderer will need to run an onunload event handler. | 215 // for which another renderer will need to run an onunload event handler. |
195 // This is called before the first navigation event for this RenderViewHost, | 216 // This is called before the first navigation event for this RenderViewHost, |
196 // and again after the corresponding OnCrossSiteResponse. | 217 // and again after the corresponding OnCrossSiteResponse. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 const gfx::Point& image_offset); | 530 const gfx::Point& image_offset); |
510 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); | 531 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); |
511 void OnTakeFocus(bool reverse); | 532 void OnTakeFocus(bool reverse); |
512 void OnAddMessageToConsole(int32 level, | 533 void OnAddMessageToConsole(int32 level, |
513 const std::wstring& message, | 534 const std::wstring& message, |
514 int32 line_no, | 535 int32 line_no, |
515 const std::wstring& source_id); | 536 const std::wstring& source_id); |
516 void OnUpdateInspectorSetting(const std::string& key, | 537 void OnUpdateInspectorSetting(const std::string& key, |
517 const std::string& value); | 538 const std::string& value); |
518 void OnMsgShouldCloseACK(bool proceed); | 539 void OnMsgShouldCloseACK(bool proceed); |
| 540 void OnMsgClosePageACK(); |
519 | 541 |
520 void OnAccessibilityNotifications( | 542 void OnAccessibilityNotifications( |
521 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); | 543 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); |
522 void OnCSSInserted(); | 544 void OnCSSInserted(); |
523 void OnContentBlocked(ContentSettingsType type, | 545 void OnContentBlocked(ContentSettingsType type, |
524 const std::string& resource_identifier); | 546 const std::string& resource_identifier); |
525 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); | 547 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
526 void OnUpdateZoomLimits(int minimum_percent, | 548 void OnUpdateZoomLimits(int minimum_percent, |
527 int maximum_percent, | 549 int maximum_percent, |
528 bool remember); | 550 bool remember); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 // request, until we hear back from the onbeforeunload handler of the old | 585 // request, until we hear back from the onbeforeunload handler of the old |
564 // RenderViewHost. | 586 // RenderViewHost. |
565 bool navigations_suspended_; | 587 bool navigations_suspended_; |
566 | 588 |
567 // We only buffer a suspended navigation message while we a pending RVH for a | 589 // We only buffer a suspended navigation message while we a pending RVH for a |
568 // TabContents. There will only ever be one suspended navigation, because | 590 // TabContents. There will only ever be one suspended navigation, because |
569 // TabContents will destroy the pending RVH and create a new one if a second | 591 // TabContents will destroy the pending RVH and create a new one if a second |
570 // navigation occurs. | 592 // navigation occurs. |
571 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; | 593 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; |
572 | 594 |
| 595 // Whether this RenderViewHost is currently swapped out, such that the view is |
| 596 // being rendered by another process. |
| 597 bool is_swapped_out_; |
| 598 |
573 // If we were asked to RunModal, then this will hold the reply_msg that we | 599 // If we were asked to RunModal, then this will hold the reply_msg that we |
574 // must return to the renderer to unblock it. | 600 // must return to the renderer to unblock it. |
575 IPC::Message* run_modal_reply_msg_; | 601 IPC::Message* run_modal_reply_msg_; |
576 | 602 |
577 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 603 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
578 // ensures we don't spam the renderer with multiple beforeunload requests. | 604 // ensures we don't spam the renderer with multiple beforeunload requests. |
579 // When either this value or is_waiting_for_unload_ack_ is true, the value of | 605 // When either this value or is_waiting_for_unload_ack_ is true, the value of |
580 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 606 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
581 // cross-site transition or a tab close attempt. | 607 // cross-site transition or a tab close attempt. |
582 bool is_waiting_for_beforeunload_ack_; | 608 bool is_waiting_for_beforeunload_ack_; |
(...skipping 29 matching lines...) Expand all Loading... |
612 // The termination status of the last render view that terminated. | 638 // The termination status of the last render view that terminated. |
613 base::TerminationStatus render_view_termination_status_; | 639 base::TerminationStatus render_view_termination_status_; |
614 | 640 |
615 // A list of observers that filter messages. Weak references. | 641 // A list of observers that filter messages. Weak references. |
616 ObserverList<RenderViewHostObserver> observers_; | 642 ObserverList<RenderViewHostObserver> observers_; |
617 | 643 |
618 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); | 644 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); |
619 }; | 645 }; |
620 | 646 |
621 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 647 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
OLD | NEW |