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

Unified Diff: extensions/browser/extension_navigation_throttle.cc

Issue 2847803004: ExtensionNavigationThrottle: No platform apps in normal tabs.
Patch Set: Merge branch 'kill_107_reboot3'' into kill_107_reboot4' Created 3 years, 7 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
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_navigation_throttle.cc
diff --git a/extensions/browser/extension_navigation_throttle.cc b/extensions/browser/extension_navigation_throttle.cc
index 8fcc2c66ade7d604939000228e137c7cdf5afc4c..731e76956b92c9f7ba92c10e82fc3b350e56a291 100644
--- a/extensions/browser/extension_navigation_throttle.cc
+++ b/extensions/browser/extension_navigation_throttle.cc
@@ -14,6 +14,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/url_request_util.h"
+#include "extensions/browser/view_type_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
@@ -108,6 +109,20 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
return content::NavigationThrottle::BLOCK_REQUEST;
}
+ // Platform apps should only load in app windows, or guest views; never in
+ // regular tabs. TODO(nick): Further restrict the !guest case below.
+ if (target_extension->is_platform_app() && !guest) {
+ switch (GetViewType(web_contents)) {
+ case VIEW_TYPE_APP_WINDOW:
+ case VIEW_TYPE_BACKGROUND_CONTENTS:
+ case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE:
+ case VIEW_TYPE_PANEL:
+ break;
+ default:
+ return content::NavigationThrottle::CANCEL;
+ }
+ }
+
return content::NavigationThrottle::PROCEED;
}
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698