summaryrefslogtreecommitdiffstats
path: root/extensions/browser/extension_util.cc
diff options
context:
space:
mode:
authorkundaji <kundaji@chromium.org>2015-09-18 16:19:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-18 23:19:46 +0000
commite548e74412d0a18f8829ce60201eb953a700b09b (patch)
tree4ead1264cfb19591b40be5177c35ba7bbb473970 /extensions/browser/extension_util.cc
parent7305eb15590a4a3b363eeed2f1ed1b8638ee37fe (diff)
downloadchromium_src-e548e74412d0a18f8829ce60201eb953a700b09b.zip
chromium_src-e548e74412d0a18f8829ce60201eb953a700b09b.tar.gz
chromium_src-e548e74412d0a18f8829ce60201eb953a700b09b.tar.bz2
Allow extensions to specify that they are not allowed in incognito mode.
Add "not_allowed" as a valid value to the "incognito" field in the manifest. Track incognito behavior using an enum instead of a boolean to distinguish between "split", "spanning", and "not_allowed". Add CanBeIncognitoEnabled method to utils which checks the manifest entry in addition to checking if extension is platform app or component. BUG=455756 Review URL: https://codereview.chromium.org/1351223003 Cr-Commit-Position: refs/heads/master@{#349806}
Diffstat (limited to 'extensions/browser/extension_util.cc')
-rw-r--r--extensions/browser/extension_util.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/extensions/browser/extension_util.cc b/extensions/browser/extension_util.cc
index d8dbe62..23de130 100644
--- a/extensions/browser/extension_util.cc
+++ b/extensions/browser/extension_util.cc
@@ -7,6 +7,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/manifest_handlers/app_isolation_info.h"
+#include "extensions/common/manifest_handlers/incognito_info.h"
namespace extensions {
namespace util {
@@ -48,5 +49,11 @@ bool SiteHasIsolatedStorage(const GURL& extension_site_url,
return extension && AppIsolationInfo::HasIsolatedStorage(extension);
}
+bool CanBeIncognitoEnabled(const Extension* extension) {
+ return IncognitoInfo::IsIncognitoAllowed(extension) &&
+ (!extension->is_platform_app() ||
+ extension->location() == Manifest::COMPONENT);
+}
+
} // namespace util
} // namespace extensions