OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 frame->provisionalDataSource()->setNavigationStartTime( | 772 frame->provisionalDataSource()->setNavigationStartTime( |
773 navigation_start_seconds); | 773 navigation_start_seconds); |
774 } | 774 } |
775 } | 775 } |
776 | 776 |
777 // In case LoadRequest failed before DidCreateDataSource was called. | 777 // In case LoadRequest failed before DidCreateDataSource was called. |
778 render_view_->pending_navigation_params_.reset(); | 778 render_view_->pending_navigation_params_.reset(); |
779 } | 779 } |
780 | 780 |
781 void RenderFrameImpl::OnBeforeUnload() { | 781 void RenderFrameImpl::OnBeforeUnload() { |
782 // TODO(creis): Move dispatchBeforeUnloadEvent to WebFrame. Until then, this | 782 // TODO(creis): Right now, this is only called on the main frame. Make the |
783 // should only be called on the main frame. Eventually, the browser process | 783 // browser process send dispatchBeforeUnloadEvent to every frame that needs |
784 // should dispatch it to every frame that needs it. | 784 // it. |
785 CHECK(!frame_->parent()); | 785 CHECK(!frame_->parent()); |
786 | 786 |
787 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); | 787 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); |
788 bool proceed = render_view_->webview()->dispatchBeforeUnloadEvent(); | 788 bool proceed = frame_->dispatchBeforeUnloadEvent(); |
789 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); | 789 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); |
790 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, | 790 Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed, |
791 before_unload_start_time, | 791 before_unload_start_time, |
792 before_unload_end_time)); | 792 before_unload_end_time)); |
793 } | 793 } |
794 | 794 |
795 void RenderFrameImpl::OnSwapOut() { | 795 void RenderFrameImpl::OnSwapOut() { |
796 // Only run unload if we're not swapped out yet, but send the ack either way. | 796 // Only run unload if we're not swapped out yet, but send the ack either way. |
797 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { | 797 if (!is_swapped_out_ || !render_view_->is_swapped_out_) { |
798 // Swap this RenderFrame out so the frame can navigate to a page rendered by | 798 // Swap this RenderFrame out so the frame can navigate to a page rendered by |
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 selection_text_offset_ = offset; | 2968 selection_text_offset_ = offset; |
2969 selection_range_ = range; | 2969 selection_range_ = range; |
2970 // This IPC is dispatched by RenderWidetHost, so use its routing ID. | 2970 // This IPC is dispatched by RenderWidetHost, so use its routing ID. |
2971 Send(new ViewHostMsg_SelectionChanged( | 2971 Send(new ViewHostMsg_SelectionChanged( |
2972 GetRenderWidget()->routing_id(), text, offset, range)); | 2972 GetRenderWidget()->routing_id(), text, offset, range)); |
2973 } | 2973 } |
2974 GetRenderWidget()->UpdateSelectionBounds(); | 2974 GetRenderWidget()->UpdateSelectionBounds(); |
2975 } | 2975 } |
2976 | 2976 |
2977 } // namespace content | 2977 } // namespace content |
OLD | NEW |