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

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

Issue 2655433002: Execute BeforeUnload on subframe browser-initiated navigations (Closed)
Patch Set: Execute BeforeUnload on subframe browser-initiated navigations Created 3 years, 11 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
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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 } 1651 }
1652 1652
1653 void RenderFrameImpl::SetPendingNavigationParams( 1653 void RenderFrameImpl::SetPendingNavigationParams(
1654 std::unique_ptr<NavigationParams> navigation_params) { 1654 std::unique_ptr<NavigationParams> navigation_params) {
1655 pending_navigation_params_ = std::move(navigation_params); 1655 pending_navigation_params_ = std::move(navigation_params);
1656 } 1656 }
1657 1657
1658 void RenderFrameImpl::OnBeforeUnload(bool is_reload) { 1658 void RenderFrameImpl::OnBeforeUnload(bool is_reload) {
1659 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::OnBeforeUnload", 1659 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::OnBeforeUnload",
1660 "id", routing_id_); 1660 "id", routing_id_);
1661 // TODO(creis): Right now, this is only called on the main frame. Make the
1662 // browser process send dispatchBeforeUnloadEvent to every frame that needs
1663 // it.
1664 CHECK(!frame_->parent());
1665
1666 // Save the routing_id, as the RenderFrameImpl can be deleted in 1661 // Save the routing_id, as the RenderFrameImpl can be deleted in
1667 // dispatchBeforeUnloadEvent. See https://crbug.com/666714 for details. 1662 // dispatchBeforeUnloadEvent. See https://crbug.com/666714 for details.
1668 int routing_id = routing_id_; 1663 int routing_id = routing_id_;
1669 1664
1670 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); 1665 base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
1671 bool proceed = frame_->dispatchBeforeUnloadEvent(is_reload); 1666 bool proceed = frame_->dispatchBeforeUnloadEvent(is_reload);
1672 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); 1667 base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
1673 RenderThread::Get()->Send(new FrameHostMsg_BeforeUnload_ACK( 1668 RenderThread::Get()->Send(new FrameHostMsg_BeforeUnload_ACK(
1674 routing_id, proceed, before_unload_start_time, before_unload_end_time)); 1669 routing_id, proceed, before_unload_start_time, before_unload_end_time));
1675 } 1670 }
(...skipping 5203 matching lines...) Expand 10 before | Expand all | Expand 10 after
6879 // event target. Potentially a Pepper plugin will receive the event. 6874 // event target. Potentially a Pepper plugin will receive the event.
6880 // In order to tell whether a plugin gets the last mouse event and which it 6875 // In order to tell whether a plugin gets the last mouse event and which it
6881 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6876 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6882 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6877 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6883 // |pepper_last_mouse_event_target_|. 6878 // |pepper_last_mouse_event_target_|.
6884 pepper_last_mouse_event_target_ = nullptr; 6879 pepper_last_mouse_event_target_ = nullptr;
6885 #endif 6880 #endif
6886 } 6881 }
6887 6882
6888 } // namespace content 6883 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698