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

Unified Diff: chrome/browser/extensions/extension_view_host.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, 3 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
Index: chrome/browser/extensions/extension_view_host.cc
diff --git a/chrome/browser/extensions/extension_view_host.cc b/chrome/browser/extensions/extension_view_host.cc
index 615e13cd8abf6e28db278d05fbf2ccec1f60db9e..ea544c71fd365928d990663cee02277bf889e04e 100644
--- a/chrome/browser/extensions/extension_view_host.cc
+++ b/chrome/browser/extensions/extension_view_host.cc
@@ -165,6 +165,14 @@ WebContents* ExtensionViewHost::OpenURLFromTab(
}
}
+bool ExtensionViewHost::ShouldTransferNavigation(
+ bool is_main_frame_navigation) {
+ // Block navigations that cause main frame of an extension pop-up (or
+ // background page) to navigate to non-extension content (i.e. to web
+ // content).
+ return !is_main_frame_navigation;
+}
+
bool ExtensionViewHost::PreHandleKeyboardEvent(
WebContents* source,
const NativeWebKeyboardEvent& event,

Powered by Google App Engine
This is Rietveld 408576698