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

Side by Side Diff: content/renderer/render_widget.cc

Issue 10344028: Support cross-process window.close() messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « content/public/browser/render_view_host_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 } 1248 }
1249 1249
1250 void RenderWidget::didBlur() { 1250 void RenderWidget::didBlur() {
1251 } 1251 }
1252 1252
1253 void RenderWidget::DoDeferredClose() { 1253 void RenderWidget::DoDeferredClose() {
1254 Send(new ViewHostMsg_Close(routing_id_)); 1254 Send(new ViewHostMsg_Close(routing_id_));
1255 } 1255 }
1256 1256
1257 void RenderWidget::closeWidgetSoon() { 1257 void RenderWidget::closeWidgetSoon() {
1258 if (is_swapped_out_) {
1259 // This widget is currently swapped out, and the active widget is in a
1260 // different process. Have the browser route the close request to the
1261 // active widget instead, so that the correct unload handlers are run.
1262 Send(new ViewHostMsg_RouteCloseEvent(routing_id_));
1263 return;
1264 }
1265
1258 // If a page calls window.close() twice, we'll end up here twice, but that's 1266 // If a page calls window.close() twice, we'll end up here twice, but that's
1259 // OK. It is safe to send multiple Close messages. 1267 // OK. It is safe to send multiple Close messages.
1260 1268
1261 // Ask the RenderWidgetHost to initiate close. We could be called from deep 1269 // Ask the RenderWidgetHost to initiate close. We could be called from deep
1262 // in Javascript. If we ask the RendwerWidgetHost to close now, the window 1270 // in Javascript. If we ask the RendwerWidgetHost to close now, the window
1263 // could be closed before the JS finishes executing. So instead, post a 1271 // could be closed before the JS finishes executing. So instead, post a
1264 // message back to the message loop, which won't run until the JS is 1272 // message back to the message loop, which won't run until the JS is
1265 // complete, and then the Close message can be sent. 1273 // complete, and then the Close message can be sent.
1266 MessageLoop::current()->PostTask( 1274 MessageLoop::current()->PostTask(
1267 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); 1275 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this));
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 } 1727 }
1720 } 1728 }
1721 1729
1722 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1730 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1723 return false; 1731 return false;
1724 } 1732 }
1725 1733
1726 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1734 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1727 return false; 1735 return false;
1728 } 1736 }
OLDNEW
« no previous file with comments | « content/public/browser/render_view_host_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698