| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 const gfx::Point& image_offset); | 524 const gfx::Point& image_offset); |
| 504 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); | 525 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); |
| 505 void OnTakeFocus(bool reverse); | 526 void OnTakeFocus(bool reverse); |
| 506 void OnAddMessageToConsole(int32 level, | 527 void OnAddMessageToConsole(int32 level, |
| 507 const std::wstring& message, | 528 const std::wstring& message, |
| 508 int32 line_no, | 529 int32 line_no, |
| 509 const std::wstring& source_id); | 530 const std::wstring& source_id); |
| 510 void OnUpdateInspectorSetting(const std::string& key, | 531 void OnUpdateInspectorSetting(const std::string& key, |
| 511 const std::string& value); | 532 const std::string& value); |
| 512 void OnMsgShouldCloseACK(bool proceed); | 533 void OnMsgShouldCloseACK(bool proceed); |
| 534 void OnMsgClosePageACK(); |
| 513 | 535 |
| 514 void OnAccessibilityNotifications( | 536 void OnAccessibilityNotifications( |
| 515 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); | 537 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); |
| 516 void OnCSSInserted(); | 538 void OnCSSInserted(); |
| 517 void OnContentBlocked(ContentSettingsType type, | 539 void OnContentBlocked(ContentSettingsType type, |
| 518 const std::string& resource_identifier); | 540 const std::string& resource_identifier); |
| 519 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); | 541 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
| 520 void OnUpdateZoomLimits(int minimum_percent, | 542 void OnUpdateZoomLimits(int minimum_percent, |
| 521 int maximum_percent, | 543 int maximum_percent, |
| 522 bool remember); | 544 bool remember); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // request, until we hear back from the onbeforeunload handler of the old | 579 // request, until we hear back from the onbeforeunload handler of the old |
| 558 // RenderViewHost. | 580 // RenderViewHost. |
| 559 bool navigations_suspended_; | 581 bool navigations_suspended_; |
| 560 | 582 |
| 561 // We only buffer a suspended navigation message while we a pending RVH for a | 583 // We only buffer a suspended navigation message while we a pending RVH for a |
| 562 // TabContents. There will only ever be one suspended navigation, because | 584 // TabContents. There will only ever be one suspended navigation, because |
| 563 // TabContents will destroy the pending RVH and create a new one if a second | 585 // TabContents will destroy the pending RVH and create a new one if a second |
| 564 // navigation occurs. | 586 // navigation occurs. |
| 565 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; | 587 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; |
| 566 | 588 |
| 589 // Whether this RenderViewHost is currently swapped out, such that the view is |
| 590 // being rendered by another process. |
| 591 bool is_swapped_out_; |
| 592 |
| 567 // If we were asked to RunModal, then this will hold the reply_msg that we | 593 // If we were asked to RunModal, then this will hold the reply_msg that we |
| 568 // must return to the renderer to unblock it. | 594 // must return to the renderer to unblock it. |
| 569 IPC::Message* run_modal_reply_msg_; | 595 IPC::Message* run_modal_reply_msg_; |
| 570 | 596 |
| 571 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 597 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
| 572 // ensures we don't spam the renderer with multiple beforeunload requests. | 598 // ensures we don't spam the renderer with multiple beforeunload requests. |
| 573 // When either this value or is_waiting_for_unload_ack_ is true, the value of | 599 // When either this value or is_waiting_for_unload_ack_ is true, the value of |
| 574 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 600 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
| 575 // cross-site transition or a tab close attempt. | 601 // cross-site transition or a tab close attempt. |
| 576 bool is_waiting_for_beforeunload_ack_; | 602 bool is_waiting_for_beforeunload_ack_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 602 // The termination status of the last render view that terminated. | 628 // The termination status of the last render view that terminated. |
| 603 base::TerminationStatus render_view_termination_status_; | 629 base::TerminationStatus render_view_termination_status_; |
| 604 | 630 |
| 605 // A list of observers that filter messages. Weak references. | 631 // A list of observers that filter messages. Weak references. |
| 606 ObserverList<RenderViewHostObserver> observers_; | 632 ObserverList<RenderViewHostObserver> observers_; |
| 607 | 633 |
| 608 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); | 634 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); |
| 609 }; | 635 }; |
| 610 | 636 |
| 611 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 637 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |