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

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

Issue 2377833002: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: Add missing files under chrome/test/data/extensions/api_test/browser_action/popup_with_form/ 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_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 if (method != "POST" && post_body) { 749 if (method != "POST" && post_body) {
750 NOTREACHED(); 750 NOTREACHED();
751 post_body = nullptr; 751 post_body = nullptr;
752 } 752 }
753 753
754 // This call only makes sense for subframes if OOPIFs are possible. 754 // This call only makes sense for subframes if OOPIFs are possible.
755 DCHECK(!render_frame_host->GetParent() || 755 DCHECK(!render_frame_host->GetParent() ||
756 SiteIsolationPolicy::AreCrossProcessFramesPossible()); 756 SiteIsolationPolicy::AreCrossProcessFramesPossible());
757 757
758 // Allow the delegate to cancel the transfer. 758 // Allow the delegate to cancel the transfer.
759 if (!delegate_->ShouldTransferNavigation()) 759 if (!delegate_->ShouldTransferNavigation(
760 render_frame_host->frame_tree_node()->IsMainFrame()))
760 return; 761 return;
761 762
762 GURL dest_url(url); 763 GURL dest_url(url);
763 Referrer referrer_to_use(referrer); 764 Referrer referrer_to_use(referrer);
764 FrameTreeNode* node = render_frame_host->frame_tree_node(); 765 FrameTreeNode* node = render_frame_host->frame_tree_node();
765 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); 766 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance();
766 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, 767 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance,
767 url)) { 768 url)) {
768 dest_url = GURL(url::kAboutBlankURL); 769 dest_url = GURL(url::kAboutBlankURL);
769 } 770 }
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 if (pending_entry != controller_->GetVisibleEntry() || 1201 if (pending_entry != controller_->GetVisibleEntry() ||
1201 !should_preserve_entry) { 1202 !should_preserve_entry) {
1202 controller_->DiscardPendingEntry(true); 1203 controller_->DiscardPendingEntry(true);
1203 1204
1204 // Also force the UI to refresh. 1205 // Also force the UI to refresh.
1205 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1206 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1206 } 1207 }
1207 } 1208 }
1208 1209
1209 } // namespace content 1210 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698