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

Unified Diff: chrome/browser/extensions/extension_view_host.cc

Issue 2380193003: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: 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 684bbf3e8793b18dd328df1f330226b1e5f7c7fa..43ae705c3cd6ab28468a13dd0202cad115a7ee03 100644
--- a/chrome/browser/extensions/extension_view_host.cc
+++ b/chrome/browser/extensions/extension_view_host.cc
@@ -166,6 +166,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,
« no previous file with comments | « chrome/browser/extensions/extension_view_host.h ('k') | chrome/browser/extensions/process_management_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698