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

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

Issue 216793014: Move dispatchBeforeUnloadEvent to WebFrame, part 2/3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « no previous file | content/shell/renderer/test_runner/test_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/shell/renderer/test_runner/test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698