OLD | NEW |
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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 NO_RESIZE_ACK); | 847 NO_RESIZE_ACK); |
848 view_screen_rect_ = new_window_rect; | 848 view_screen_rect_ = new_window_rect; |
849 window_screen_rect_ = new_window_rect; | 849 window_screen_rect_ = new_window_rect; |
850 if (!did_show_) | 850 if (!did_show_) |
851 initial_rect_ = new_window_rect; | 851 initial_rect_ = new_window_rect; |
852 } | 852 } |
853 | 853 |
854 void RenderWidget::OnClose() { | 854 void RenderWidget::OnClose() { |
855 if (closing_) | 855 if (closing_) |
856 return; | 856 return; |
857 NotifyOnClose(); | |
858 closing_ = true; | 857 closing_ = true; |
859 | 858 |
860 // Browser correspondence is no longer needed at this point. | 859 // Browser correspondence is no longer needed at this point. |
861 if (routing_id_ != MSG_ROUTING_NONE) { | 860 if (routing_id_ != MSG_ROUTING_NONE) { |
862 if (RenderThreadImpl::current()) | 861 if (RenderThreadImpl::current()) |
863 RenderThreadImpl::current()->WidgetDestroyed(); | 862 RenderThreadImpl::current()->WidgetDestroyed(); |
864 RenderThread::Get()->RemoveRoute(routing_id_); | 863 RenderThread::Get()->RemoveRoute(routing_id_); |
865 SetHidden(false); | 864 SetHidden(false); |
866 } | 865 } |
867 | 866 |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 } | 1530 } |
1532 | 1531 |
1533 void RenderWidget::didBlur() { | 1532 void RenderWidget::didBlur() { |
1534 } | 1533 } |
1535 | 1534 |
1536 void RenderWidget::DoDeferredClose() { | 1535 void RenderWidget::DoDeferredClose() { |
1537 WillCloseLayerTreeView(); | 1536 WillCloseLayerTreeView(); |
1538 Send(new ViewHostMsg_Close(routing_id_)); | 1537 Send(new ViewHostMsg_Close(routing_id_)); |
1539 } | 1538 } |
1540 | 1539 |
1541 void RenderWidget::NotifyOnClose() { | |
1542 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, WidgetWillClose()); | |
1543 } | |
1544 | |
1545 void RenderWidget::closeWidgetSoon() { | 1540 void RenderWidget::closeWidgetSoon() { |
1546 if (is_swapped_out_) { | 1541 if (is_swapped_out_) { |
1547 // This widget is currently swapped out, and the active widget is in a | 1542 // This widget is currently swapped out, and the active widget is in a |
1548 // different process. Have the browser route the close request to the | 1543 // different process. Have the browser route the close request to the |
1549 // active widget instead, so that the correct unload handlers are run. | 1544 // active widget instead, so that the correct unload handlers are run. |
1550 Send(new ViewHostMsg_RouteCloseEvent(routing_id_)); | 1545 Send(new ViewHostMsg_RouteCloseEvent(routing_id_)); |
1551 return; | 1546 return; |
1552 } | 1547 } |
1553 | 1548 |
1554 // If a page calls window.close() twice, we'll end up here twice, but that's | 1549 // If a page calls window.close() twice, we'll end up here twice, but that's |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2423 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2429 video_hole_frames_.AddObserver(frame); | 2424 video_hole_frames_.AddObserver(frame); |
2430 } | 2425 } |
2431 | 2426 |
2432 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2427 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2433 video_hole_frames_.RemoveObserver(frame); | 2428 video_hole_frames_.RemoveObserver(frame); |
2434 } | 2429 } |
2435 #endif // defined(VIDEO_HOLE) | 2430 #endif // defined(VIDEO_HOLE) |
2436 | 2431 |
2437 } // namespace content | 2432 } // namespace content |
OLD | NEW |