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

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

Issue 789383002: Add the basic infrastructure for the Behavior feature type: BehaviorFeature and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flag-features
Patch Set: behavior Created 6 years 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 | « no previous file | chrome/common/extensions/chrome_extensions_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index f6ebc499445206ef47caf300c7f3ba22d45ce0a0..3250e90439d5fe5274790358920f090e7a1704fe 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -24,7 +24,8 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
#include "extensions/common/feature_switch.h"
-#include "extensions/common/features/simple_feature.h"
+#include "extensions/common/features/behavior_feature.h"
+#include "extensions/common/features/feature_provider.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -41,20 +42,13 @@ namespace {
const char kExtensionAllowedOnAllUrlsPrefName[] =
"extension_can_script_all_urls";
-// Returns true if |extension_id| for an external component extension should
-// always be enabled in incognito windows.
-bool IsWhitelistedForIncognito(const std::string& extension_id) {
- static const char* const kExtensionWhitelist[] = {
- "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2", // http://crbug.com/312900
- "D57DE394F36DC1C3220E7604C575D29C51A6C495", // http://crbug.com/319444
- "3F65507A3B39259B38C8173C6FFA3D12DF64CCE9" // http://crbug.com/371562
- };
-
- return extensions::SimpleFeature::IsIdInList(
- extension_id,
- std::set<std::string>(
- kExtensionWhitelist,
- kExtensionWhitelist + arraysize(kExtensionWhitelist)));
+// Returns true if |extension_id| should always be enabled in incognito
+// windows.
+bool IsWhitelistedForIncognito(const Extension* extension) {
+ return FeatureProvider::GetBehaviorFeatures()
+ ->GetFeature(BehaviorFeature::kWhitelistedForIncognito)
+ ->IsAvailableToExtension(extension)
+ .is_available();
}
// Returns |extension_id|. See note below.
@@ -90,12 +84,9 @@ bool IsIncognitoEnabled(const std::string& extension_id,
// work in incognito mode.
if (extension->location() == Manifest::COMPONENT)
return true;
- if (extension->location() == Manifest::EXTERNAL_COMPONENT &&
- IsWhitelistedForIncognito(extension_id)) {
+ if (IsWhitelistedForIncognito(extension))
Ken Rockot(use gerrit already) 2014/12/11 22:32:21 This doesn't seem equivalent to the previous condi
not at google - send to devlin 2014/12/11 22:41:23 Yeah, exactly. I would need to add support for ext
return true;
- }
}
-
return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id);
}
« no previous file with comments | « no previous file | chrome/common/extensions/chrome_extensions_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698