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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2380193003: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // Select an appropriate renderer to commit the navigation. 313 // Select an appropriate renderer to commit the navigation.
314 RenderFrameHostImpl* render_frame_host = 314 RenderFrameHostImpl* render_frame_host =
315 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); 315 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
316 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, 316 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host,
317 common_params_.url); 317 common_params_.url);
318 318
319 // For renderer-initiated navigations that are set to commit in a different 319 // For renderer-initiated navigations that are set to commit in a different
320 // renderer, allow the embedder to cancel the transfer. 320 // renderer, allow the embedder to cancel the transfer.
321 if (!browser_initiated_ && 321 if (!browser_initiated_ &&
322 render_frame_host != frame_tree_node_->current_frame_host() && 322 render_frame_host != frame_tree_node_->current_frame_host() &&
323 !frame_tree_node_->navigator() 323 !frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation(
324 ->GetDelegate() 324 frame_tree_node_->IsMainFrame())) {
325 ->ShouldTransferNavigation()) {
326 frame_tree_node_->ResetNavigationRequest(false); 325 frame_tree_node_->ResetNavigationRequest(false);
327 return; 326 return;
328 } 327 }
329 328
330 if (navigation_data) 329 if (navigation_data)
331 navigation_handle_->set_navigation_data(std::move(navigation_data)); 330 navigation_handle_->set_navigation_data(std::move(navigation_data));
332 331
333 // Store the response and the StreamHandle until checks have been processed. 332 // Store the response and the StreamHandle until checks have been processed.
334 response_ = response; 333 response_ = response;
335 body_ = std::move(body); 334 body_ = std::move(body);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 458
460 TransferNavigationHandleOwnership(render_frame_host); 459 TransferNavigationHandleOwnership(render_frame_host);
461 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 460 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
462 common_params_, request_params_, 461 common_params_, request_params_,
463 is_view_source_); 462 is_view_source_);
464 463
465 frame_tree_node_->ResetNavigationRequest(true); 464 frame_tree_node_->ResetNavigationRequest(true);
466 } 465 }
467 466
468 } // namespace content 467 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cross_site_transfer_browsertest.cc ('k') | content/browser/frame_host/navigator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698