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

Side by Side Diff: content/browser/frame_host/navigator_impl.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 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 #include "content/browser/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 if (method != "POST" && post_body) { 760 if (method != "POST" && post_body) {
761 NOTREACHED(); 761 NOTREACHED();
762 post_body = nullptr; 762 post_body = nullptr;
763 } 763 }
764 764
765 // This call only makes sense for subframes if OOPIFs are possible. 765 // This call only makes sense for subframes if OOPIFs are possible.
766 DCHECK(!render_frame_host->GetParent() || 766 DCHECK(!render_frame_host->GetParent() ||
767 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 767 SiteIsolationPolicy::AreCrossProcessFramesPossible());
768 768
769 // Allow the delegate to cancel the transfer. 769 // Allow the delegate to cancel the transfer.
770 if (!delegate_->ShouldTransferNavigation()) 770 if (!delegate_->ShouldTransferNavigation(
771 render_frame_host->frame_tree_node()->IsMainFrame()))
771 return; 772 return;
772 773
773 GURL dest_url(url); 774 GURL dest_url(url);
774 Referrer referrer_to_use(referrer); 775 Referrer referrer_to_use(referrer);
775 FrameTreeNode* node = render_frame_host->frame_tree_node(); 776 FrameTreeNode* node = render_frame_host->frame_tree_node();
776 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); 777 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance();
777 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, 778 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance,
778 url)) { 779 url)) {
779 dest_url = GURL(url::kAboutBlankURL); 780 dest_url = GURL(url::kAboutBlankURL);
780 } 781 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 if (pending_entry != controller_->GetVisibleEntry() || 1209 if (pending_entry != controller_->GetVisibleEntry() ||
1209 !should_preserve_entry) { 1210 !should_preserve_entry) {
1210 controller_->DiscardPendingEntry(true); 1211 controller_->DiscardPendingEntry(true);
1211 1212
1212 // Also force the UI to refresh. 1213 // Also force the UI to refresh.
1213 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1214 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1214 } 1215 }
1215 } 1216 }
1216 1217
1217 } // namespace content 1218 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_delegate.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698