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

Side by Side Diff: content/public/browser/web_contents.h

Issue 2856653004: Require a process ID when looking up RFHs by FrameTreeNode ID. (Closed)
Patch Set: Simplify ExtNavThrottle Created 3 years, 7 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 (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 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // these may change over time. 238 // these may change over time.
239 virtual RenderProcessHost* GetRenderProcessHost() const = 0; 239 virtual RenderProcessHost* GetRenderProcessHost() const = 0;
240 240
241 // Returns the main frame for the currently active view. 241 // Returns the main frame for the currently active view.
242 virtual RenderFrameHost* GetMainFrame() = 0; 242 virtual RenderFrameHost* GetMainFrame() = 0;
243 243
244 // Returns the focused frame for the currently active view. 244 // Returns the focused frame for the currently active view.
245 virtual RenderFrameHost* GetFocusedFrame() = 0; 245 virtual RenderFrameHost* GetFocusedFrame() = 0;
246 246
247 // Returns the current RenderFrameHost for a given FrameTreeNode ID if it is 247 // Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
248 // part of this tab. See RenderFrameHost::GetFrameTreeNodeId for documentation 248 // part of this frame tree, not including frames in any inner WebContents.
249 // on this ID. 249 // Returns nullptr if |process_id| does not match the current
250 virtual RenderFrameHost* FindFrameByFrameTreeNodeId( 250 // RenderFrameHost's process ID, to avoid security bugs where callers do not
251 // realize a cross-process navigation (and thus privilege change) has taken
252 // place. See RenderFrameHost::GetFrameTreeNodeId for documentation on
253 // frame_tree_node_id.
254 virtual RenderFrameHost* FindFrameByFrameTreeNodeId(int frame_tree_node_id,
255 int process_id) = 0;
256
257 // NOTE: This is generally unsafe to use. Use FindFrameByFrameTreeNodeId
258 // instead.
259 // Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
260 // part of this frame tree. This may not match the caller's expectation, if a
261 // cross-process navigation (and thus privilege change) has taken place.
262 // See RenderFrameHost::GetFrameTreeNodeId for documentation on this ID.
263 virtual RenderFrameHost* UnsafeFindFrameByFrameTreeNodeId(
251 int frame_tree_node_id) = 0; 264 int frame_tree_node_id) = 0;
252 265
253 // Calls |on_frame| for each frame in the currently active view. 266 // Calls |on_frame| for each frame in the currently active view.
254 // Note: The RenderFrameHost parameter is not guaranteed to have a live 267 // Note: The RenderFrameHost parameter is not guaranteed to have a live
255 // RenderFrame counterpart in the renderer process. Callbacks should check 268 // RenderFrame counterpart in the renderer process. Callbacks should check
256 // IsRenderFrameLive, as sending IPC messages to it in this case will fail 269 // IsRenderFrameLive, as sending IPC messages to it in this case will fail
257 // silently. 270 // silently.
258 virtual void ForEachFrame( 271 virtual void ForEachFrame(
259 const base::Callback<void(RenderFrameHost*)>& on_frame) = 0; 272 const base::Callback<void(RenderFrameHost*)>& on_frame) = 0;
260 273
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 807
795 private: 808 private:
796 // This interface should only be implemented inside content. 809 // This interface should only be implemented inside content.
797 friend class WebContentsImpl; 810 friend class WebContentsImpl;
798 WebContents() {} 811 WebContents() {}
799 }; 812 };
800 813
801 } // namespace content 814 } // namespace content
802 815
803 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ 816 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698