| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // for a cross-site navigation, because we must suspend any navigations until | 139 // for a cross-site navigation, because we must suspend any navigations until |
| 140 // we hear back from the old renderer's onbeforeunload handler. Note that it | 140 // we hear back from the old renderer's onbeforeunload handler. Note that it |
| 141 // is important that only one navigation event happen after calling this | 141 // is important that only one navigation event happen after calling this |
| 142 // method with |suspend| equal to true. If |suspend| is false and there is | 142 // method with |suspend| equal to true. If |suspend| is false and there is |
| 143 // a suspended_nav_message_, this will send the message. This function | 143 // a suspended_nav_message_, this will send the message. This function |
| 144 // should only be called to toggle the state; callers should check | 144 // should only be called to toggle the state; callers should check |
| 145 // are_navigations_suspended() first. | 145 // are_navigations_suspended() first. |
| 146 void SetNavigationsSuspended(bool suspend); | 146 void SetNavigationsSuspended(bool suspend); |
| 147 | 147 |
| 148 // Causes the renderer to invoke the onbeforeunload event handler. The | 148 // Causes the renderer to invoke the onbeforeunload event handler. The |
| 149 // result will be returned via ViewMsg_ShouldClose. | 149 // result will be returned via ViewMsg_ShouldClose. See also ClosePage which |
| 150 // will fire the PageUnload event. |
| 150 void FirePageBeforeUnload(); | 151 void FirePageBeforeUnload(); |
| 151 | 152 |
| 152 // Close the page after the page has responded that it can be closed via | 153 // Causes the renderer to close the current page, including running its |
| 153 // ViewMsg_ShouldClose. This is where the page itself is closed. The | 154 // onunload event handler. A ClosePage_ACK message will be sent to the |
| 154 // unload handler is triggered here, which can block with a dialog, but cannot | 155 // ResourceDispatcherHost when it is finished. |
| 155 // cancel the close of the page. | 156 // |
| 156 void FirePageUnload(); | 157 // Please see ViewMsg_ClosePage in resource_messages_internal.h for a |
| 158 // description of the parameters. |
| 159 void ClosePage(bool for_cross_site_transition, |
| 160 int new_render_process_host_id, |
| 161 int new_request_id); |
| 157 | 162 |
| 158 // Close the page ignoring whether it has unload events registers. | 163 // Close the page ignoring whether it has unload events registers. |
| 159 // This is called after the beforeunload and unload events have fired | 164 // This is called after the beforeunload and unload events have fired |
| 160 // and the user has agreed to continue with closing the page. | 165 // and the user has agreed to continue with closing the page. |
| 161 static void ClosePageIgnoringUnloadEvents(int render_process_host_id, | 166 void ClosePageIgnoringUnloadEvents(); |
| 162 int request_id); | |
| 163 | |
| 164 // Causes the renderer to close the current page, including running its | |
| 165 // onunload event handler. A ClosePage_ACK message will be sent to the | |
| 166 // ResourceDispatcherHost when it is finished. |new_render_process_host_id| | |
| 167 // and |new_request_id| will help the ResourceDispatcherHost identify which | |
| 168 // response is associated with this event. | |
| 169 void ClosePage(int new_render_process_host_id, int new_request_id); | |
| 170 | 167 |
| 171 // Sets whether this RenderViewHost has an outstanding cross-site request, | 168 // Sets whether this RenderViewHost has an outstanding cross-site request, |
| 172 // for which another renderer will need to run an onunload event handler. | 169 // for which another renderer will need to run an onunload event handler. |
| 173 // This is called before the first navigation event for this RenderViewHost, | 170 // This is called before the first navigation event for this RenderViewHost, |
| 174 // and again after the corresponding OnCrossSiteResponse. | 171 // and again after the corresponding OnCrossSiteResponse. |
| 175 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); | 172 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); |
| 176 | 173 |
| 177 // Returns the request_id for the pending cross-site request. | 174 // Returns the request_id for the pending cross-site request. |
| 178 // This is just needed in case the unload of the current page | 175 // This is just needed in case the unload of the current page |
| 179 // hangs, in which case we need to swap to the pending RenderViewHost. | 176 // hangs, in which case we need to swap to the pending RenderViewHost. |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 // While in this mode, mouse click is converted into InspectElement | 624 // While in this mode, mouse click is converted into InspectElement |
| 628 // command. | 625 // command. |
| 629 bool in_inspect_element_mode_; | 626 bool in_inspect_element_mode_; |
| 630 | 627 |
| 631 NotificationRegistrar registrar_; | 628 NotificationRegistrar registrar_; |
| 632 | 629 |
| 633 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); | 630 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); |
| 634 }; | 631 }; |
| 635 | 632 |
| 636 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 633 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |