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