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

Unified Diff: extensions/browser/extension_navigation_throttle.cc

Issue 2858143002: [refactor] - Use WebContents::FindFrameByFrameTreeNodeId() instead of manually searching all frames. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_navigation_throttle.cc
diff --git a/extensions/browser/extension_navigation_throttle.cc b/extensions/browser/extension_navigation_throttle.cc
index bb5137148c7c948ae3f85f0053051e87ae883751..cf4e5e43ca2ccd6a7d94db9b70b4ece2e00dd78c 100644
--- a/extensions/browser/extension_navigation_throttle.cc
+++ b/extensions/browser/extension_navigation_throttle.cc
@@ -112,14 +112,9 @@ ExtensionNavigationThrottle::WillStartRequest() {
// we can't get it from NavigationHandle. However, this code only cares about
// the ancestor chain, so find the current RenderFrameHost and use it to
// traverse up to the main frame.
- content::RenderFrameHost* navigating_frame = nullptr;
- for (auto* frame : web_contents->GetAllFrames()) {
- if (frame->GetFrameTreeNodeId() ==
- navigation_handle()->GetFrameTreeNodeId()) {
- navigating_frame = frame;
- break;
- }
- }
+ content::RenderFrameHost* navigating_frame =
+ web_contents->FindFrameByFrameTreeNodeId(
+ navigation_handle()->GetFrameTreeNodeId());
DCHECK(navigating_frame);
// Traverse the chain of parent frames, checking if they are the same origin
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698