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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.h

Issue 159255: Fix a race condition where rapid back/forward clicks could close a tab... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 | Annotate | Revision Log
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // for a cross-site navigation, because we must suspend any navigations until 141 // for a cross-site navigation, because we must suspend any navigations until
142 // we hear back from the old renderer's onbeforeunload handler. Note that it 142 // we hear back from the old renderer's onbeforeunload handler. Note that it
143 // is important that only one navigation event happen after calling this 143 // is important that only one navigation event happen after calling this
144 // method with |suspend| equal to true. If |suspend| is false and there is 144 // method with |suspend| equal to true. If |suspend| is false and there is
145 // a suspended_nav_message_, this will send the message. This function 145 // a suspended_nav_message_, this will send the message. This function
146 // should only be called to toggle the state; callers should check 146 // should only be called to toggle the state; callers should check
147 // are_navigations_suspended() first. 147 // are_navigations_suspended() first.
148 void SetNavigationsSuspended(bool suspend); 148 void SetNavigationsSuspended(bool suspend);
149 149
150 // Causes the renderer to invoke the onbeforeunload event handler. The 150 // Causes the renderer to invoke the onbeforeunload event handler. The
151 // result will be returned via ViewMsg_ShouldClose. 151 // result will be returned via ViewMsg_ShouldClose. See also ClosePage which
152 // will fire the PageUnload event.
152 void FirePageBeforeUnload(); 153 void FirePageBeforeUnload();
153 154
154 // Close the page after the page has responded that it can be closed via 155 // Causes the renderer to close the current page, including running its
155 // ViewMsg_ShouldClose. This is where the page itself is closed. The 156 // onunload event handler. A ClosePage_ACK message will be sent to the
156 // unload handler is triggered here, which can block with a dialog, but cannot 157 // ResourceDispatcherHost when it is finished.
157 // cancel the close of the page. 158 //
158 void FirePageUnload(); 159 // Please see ViewMsg_ClosePage in resource_messages_internal.h for a
160 // description of the parameters.
161 void ClosePage(bool for_cross_site_transition,
162 int new_render_process_host_id,
163 int new_request_id);
159 164
160 // Close the page ignoring whether it has unload events registers. 165 // Close the page ignoring whether it has unload events registers.
161 // This is called after the beforeunload and unload events have fired 166 // This is called after the beforeunload and unload events have fired
162 // and the user has agreed to continue with closing the page. 167 // and the user has agreed to continue with closing the page.
163 static void ClosePageIgnoringUnloadEvents(int render_process_host_id, 168 void ClosePageIgnoringUnloadEvents();
164 int request_id);
165
166 // Causes the renderer to close the current page, including running its
167 // onunload event handler. A ClosePage_ACK message will be sent to the
168 // ResourceDispatcherHost when it is finished. |new_render_process_host_id|
169 // and |new_request_id| will help the ResourceDispatcherHost identify which
170 // response is associated with this event.
171 void ClosePage(int new_render_process_host_id, int new_request_id);
172 169
173 // Sets whether this RenderViewHost has an outstanding cross-site request, 170 // Sets whether this RenderViewHost has an outstanding cross-site request,
174 // for which another renderer will need to run an onunload event handler. 171 // for which another renderer will need to run an onunload event handler.
175 // This is called before the first navigation event for this RenderViewHost, 172 // This is called before the first navigation event for this RenderViewHost,
176 // and again after the corresponding OnCrossSiteResponse. 173 // and again after the corresponding OnCrossSiteResponse.
177 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); 174 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id);
178 175
179 // Returns the request_id for the pending cross-site request. 176 // Returns the request_id for the pending cross-site request.
180 // This is just needed in case the unload of the current page 177 // This is just needed in case the unload of the current page
181 // hangs, in which case we need to swap to the pending RenderViewHost. 178 // hangs, in which case we need to swap to the pending RenderViewHost.
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 // While in this mode, mouse click is converted into InspectElement 626 // While in this mode, mouse click is converted into InspectElement
630 // command. 627 // command.
631 bool in_inspect_element_mode_; 628 bool in_inspect_element_mode_;
632 629
633 NotificationRegistrar registrar_; 630 NotificationRegistrar registrar_;
634 631
635 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); 632 DISALLOW_COPY_AND_ASSIGN(RenderViewHost);
636 }; 633 };
637 634
638 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ 635 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_process_host.h ('k') | chrome/browser/renderer_host/render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698