From 277c414a2334e7a711d5b618313ffa429299b730 Mon Sep 17 00:00:00 2001 From: "wittman@chromium.org" Date: Thu, 19 Jun 2014 20:08:54 +0000 Subject: [PATCH] Always enable enhanced bookmarks external component extensions for incognito mode BUG=384656 Review URL: https://codereview.chromium.org/331743004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278469 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extension_util.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc index 9273ed4420aa..bd6a989e3722 100644 --- a/chrome/browser/extensions/extension_util.cc +++ b/chrome/browser/extensions/extension_util.cc @@ -21,6 +21,7 @@ #include "extensions/browser/extension_util.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" +#include "extensions/common/features/simple_feature.h" #include "extensions/common/manifest.h" #include "extensions/common/manifest_handlers/incognito_info.h" #include "grit/theme_resources.h" @@ -34,7 +35,23 @@ namespace { // all urls without explicit permission. 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* kExtensionWhitelist[] = { + "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2", // http://crbug.com/312900 + "D57DE394F36DC1C3220E7604C575D29C51A6C495", // http://crbug.com/319444 + "3F65507A3B39259B38C8173C6FFA3D12DF64CCE9" // http://crbug.com/371562 + }; + + return extensions::SimpleFeature::IsIdInList( + extension_id, + std::set( + kExtensionWhitelist, + kExtensionWhitelist + arraysize(kExtensionWhitelist))); } +} // namespace bool IsIncognitoEnabled(const std::string& extension_id, content::BrowserContext* context) { @@ -47,6 +64,10 @@ 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)) { + return true; + } } return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); -- 2.11.4.GIT