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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 2783723002: Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: fix content_browsertests with plznavigate and also remove now unnecessary unloadcontroller change Created 3 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
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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 void DispatchBeforeUnload(bool for_navigation, bool is_reload); 424 void DispatchBeforeUnload(bool for_navigation, bool is_reload);
425 425
426 // Simulate beforeunload ack on behalf of renderer if it's unrenresponsive. 426 // Simulate beforeunload ack on behalf of renderer if it's unrenresponsive.
427 void SimulateBeforeUnloadAck(); 427 void SimulateBeforeUnloadAck();
428 428
429 // Returns true if a call to DispatchBeforeUnload will actually send the 429 // Returns true if a call to DispatchBeforeUnload will actually send the
430 // BeforeUnload IPC. This is the case if the current renderer is live and this 430 // BeforeUnload IPC. This is the case if the current renderer is live and this
431 // frame is the main frame. 431 // frame is the main frame.
432 bool ShouldDispatchBeforeUnload(); 432 bool ShouldDispatchBeforeUnload();
433 433
434 // Returns true if the frame or any of its descendents have an onunload
435 // handler.
436 bool ShouldDispatchUnload();
nasko 2017/03/29 23:31:26 Since there is no dispatching of unload handler ha
jam 2017/03/30 14:53:22 Done.
437
434 // Update the frame's opener in the renderer process in response to the 438 // Update the frame's opener in the renderer process in response to the
435 // opener being modified (e.g., with window.open or being set to null) in 439 // opener being modified (e.g., with window.open or being set to null) in
436 // another renderer process. 440 // another renderer process.
437 void UpdateOpener(); 441 void UpdateOpener();
438 442
439 // Set this frame as focused in the renderer process. This supports 443 // Set this frame as focused in the renderer process. This supports
440 // cross-process window.focus() calls. 444 // cross-process window.focus() calls.
441 void SetFocusedFrame(); 445 void SetFocusedFrame();
442 446
443 // Continues sequential focus navigation in this frame. |source_proxy| 447 // Continues sequential focus navigation in this frame. |source_proxy|
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 const AccessibilityHostMsg_FindInPageResultParams& params); 760 const AccessibilityHostMsg_FindInPageResultParams& params);
757 void OnAccessibilityChildFrameHitTestResult(const gfx::Point& point, 761 void OnAccessibilityChildFrameHitTestResult(const gfx::Point& point,
758 int hit_obj_id); 762 int hit_obj_id);
759 void OnAccessibilitySnapshotResponse( 763 void OnAccessibilitySnapshotResponse(
760 int callback_id, 764 int callback_id,
761 const AXContentTreeUpdate& snapshot); 765 const AXContentTreeUpdate& snapshot);
762 void OnSmartClipDataExtracted(uint32_t id, 766 void OnSmartClipDataExtracted(uint32_t id,
763 base::string16 text, 767 base::string16 text,
764 base::string16 html); 768 base::string16 html);
765 void OnToggleFullscreen(bool enter_fullscreen); 769 void OnToggleFullscreen(bool enter_fullscreen);
770 void OnBeforeUnloadHandlersPresent(bool present);
771 void OnUnloadHandlersPresent(bool present);
766 void OnDidStartLoading(bool to_different_document); 772 void OnDidStartLoading(bool to_different_document);
767 void OnDidStopLoading(); 773 void OnDidStopLoading();
768 void OnDidChangeLoadProgress(double load_progress); 774 void OnDidChangeLoadProgress(double load_progress);
769 void OnSerializeAsMHTMLResponse( 775 void OnSerializeAsMHTMLResponse(
770 int job_id, 776 int job_id,
771 MhtmlSaveStatus save_status, 777 MhtmlSaveStatus save_status,
772 const std::set<std::string>& digests_of_uris_of_serialized_resources, 778 const std::set<std::string>& digests_of_uris_of_serialized_resources,
773 base::TimeDelta renderer_main_thread_time); 779 base::TimeDelta renderer_main_thread_time);
774 void OnSelectionChanged(const base::string16& text, 780 void OnSelectionChanged(const base::string16& text,
775 uint32_t offset, 781 uint32_t offset,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 // this RFH is the pending RenderFrameHost of a RenderFrameHostManager. There 993 // this RFH is the pending RenderFrameHost of a RenderFrameHostManager. There
988 // will only ever be one suspended navigation, because RenderFrameHostManager 994 // will only ever be one suspended navigation, because RenderFrameHostManager
989 // will destroy the pending RenderFrameHost and create a new one if a second 995 // will destroy the pending RenderFrameHost and create a new one if a second
990 // navigation occurs. 996 // navigation occurs.
991 // PlzNavigate: unused as navigations are never suspended. 997 // PlzNavigate: unused as navigations are never suspended.
992 std::unique_ptr<NavigationParams> suspended_nav_params_; 998 std::unique_ptr<NavigationParams> suspended_nav_params_;
993 999
994 // When the last BeforeUnload message was sent. 1000 // When the last BeforeUnload message was sent.
995 base::TimeTicks send_before_unload_start_time_; 1001 base::TimeTicks send_before_unload_start_time_;
996 1002
1003 // Used to track whether the frame has onbeforeunload and onunload handlers
1004 bool has_beforeunload_handlers_;
1005 bool has_unload_handlers_;
1006
997 // Set to true when there is a pending FrameMsg_BeforeUnload message. This 1007 // Set to true when there is a pending FrameMsg_BeforeUnload message. This
998 // ensures we don't spam the renderer with multiple beforeunload requests. 1008 // ensures we don't spam the renderer with multiple beforeunload requests.
999 // When either this value or IsWaitingForUnloadACK is true, the value of 1009 // When either this value or IsWaitingForUnloadACK is true, the value of
1000 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a 1010 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
1001 // cross-site transition or a tab close attempt. 1011 // cross-site transition or a tab close attempt.
1002 // TODO(clamy): Remove this boolean and add one more state to the state 1012 // TODO(clamy): Remove this boolean and add one more state to the state
1003 // machine. 1013 // machine.
1004 bool is_waiting_for_beforeunload_ack_; 1014 bool is_waiting_for_beforeunload_ack_;
1005 1015
1006 // Valid only when is_waiting_for_beforeunload_ack_ or 1016 // Valid only when is_waiting_for_beforeunload_ack_ or
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1176
1167 // NOTE: This must be the last member. 1177 // NOTE: This must be the last member.
1168 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 1178 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
1169 1179
1170 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 1180 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
1171 }; 1181 };
1172 1182
1173 } // namespace content 1183 } // namespace content
1174 1184
1175 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 1185 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698