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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc

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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 nav_event->frame_id = navigation_handle->GetFrameTreeNodeId(); 136 nav_event->frame_id = navigation_handle->GetFrameTreeNodeId();
137 137
138 // If there was a URL previously committed in the current RenderFrameHost, 138 // If there was a URL previously committed in the current RenderFrameHost,
139 // set it as the source url of this navigation. Otherwise, this is the 139 // set it as the source url of this navigation. Otherwise, this is the
140 // first url going to commit in this frame. We set navigation_handle's URL as 140 // first url going to commit in this frame. We set navigation_handle's URL as
141 // the source url. 141 // the source url.
142 // TODO(jialiul): source_url, source_tab_id, and source_main_frame_url may be 142 // TODO(jialiul): source_url, source_tab_id, and source_main_frame_url may be
143 // incorrect when another frame is targeting this frame. Need to refine this 143 // incorrect when another frame is targeting this frame. Need to refine this
144 // logic after the true initiator details are added to NavigationHandle 144 // logic after the true initiator details are added to NavigationHandle
145 // (https://crbug.com/651895). 145 // (https://crbug.com/651895).
146 int current_process_id =
147 navigation_handle->GetStartingSiteInstance()->GetProcess()->GetID();
146 content::RenderFrameHost* current_frame_host = 148 content::RenderFrameHost* current_frame_host =
147 navigation_handle->GetWebContents()->FindFrameByFrameTreeNodeId( 149 navigation_handle->GetWebContents()->FindFrameByFrameTreeNodeId(
148 nav_event->frame_id); 150 nav_event->frame_id, current_process_id);
149 // For browser initiated navigation (e.g. from address bar or bookmark), we 151 // For browser initiated navigation (e.g. from address bar or bookmark), we
150 // don't fill the source_url to prevent attributing navigation to the last 152 // don't fill the source_url to prevent attributing navigation to the last
151 // committed navigation. 153 // committed navigation.
152 if (navigation_handle->IsRendererInitiated() && current_frame_host && 154 if (navigation_handle->IsRendererInitiated() && current_frame_host &&
153 current_frame_host->GetLastCommittedURL().is_valid()) { 155 current_frame_host->GetLastCommittedURL().is_valid()) {
154 nav_event->source_url = 156 nav_event->source_url =
155 SafeBrowsingNavigationObserverManager::ClearEmptyRef( 157 SafeBrowsingNavigationObserverManager::ClearEmptyRef(
156 current_frame_host->GetLastCommittedURL()); 158 current_frame_host->GetLastCommittedURL());
157 } 159 }
158 nav_event->original_request_url = 160 nav_event->original_request_url =
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 ui::PageTransition transition, 250 ui::PageTransition transition,
249 bool started_from_context_menu, 251 bool started_from_context_menu,
250 bool renderer_initiated) { 252 bool renderer_initiated) {
251 manager_->RecordNewWebContents( 253 manager_->RecordNewWebContents(
252 web_contents(), source_render_frame_host->GetProcess()->GetID(), 254 web_contents(), source_render_frame_host->GetProcess()->GetID(),
253 source_render_frame_host->GetRoutingID(), url, new_contents, 255 source_render_frame_host->GetRoutingID(), url, new_contents,
254 renderer_initiated); 256 renderer_initiated);
255 } 257 }
256 258
257 } // namespace safe_browsing 259 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698