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

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

Issue 331743004: Always enable enhanced bookmarks external component extensions for incognito mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: rebase Created 6 years, 6 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_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 45dc7408cc3cda2f8d46ea09561abce570b7bf7a..9a454f778e65caea338d97c94e47edb086e1020c 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/sha1.h"
+#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_sync_service.h"
@@ -36,6 +38,30 @@ const char kExtensionAllowedOnAllUrlsPrefName[] =
"extension_can_script_all_urls";
}
+bool EnableIncognitoByDefault(const Extension* extension) {
+ // Internal component extensions are always enabled in IsIncognitoEnabled.
+ if (extension->location() != Manifest::EXTERNAL_COMPONENT)
+ return false;
+
+ // Enable external component extensions with hashes in this array in incognito
+ // mode.
+ static const char* kIncognitoEnabledExternalComponentExtensionHash[] = {
+ "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2", // http://crbug.com/312900
+ "D57DE394F36DC1C3220E7604C575D29C51A6C495", // http://crbug.com/319444
+ "3F65507A3B39259B38C8173C6FFA3D12DF64CCE9" // http://crbug.com/371562
+ };
+
+ std::string hash = base::SHA1HashString(extension->id());
+ hash = base::HexEncode(hash.c_str(), hash.length());
+ for (size_t i = 0;
+ i < arraysize(kIncognitoEnabledExternalComponentExtensionHash); i++) {
+ if (hash == kIncognitoEnabledExternalComponentExtensionHash[i])
+ return true;
+ }
not at google - send to devlin 2014/06/18 23:49:20 see code here: https://code.google.com/p/chromium
Mike Wittman 2014/06/19 00:21:49 Done.
+
+ return false;
+}
+
bool IsIncognitoEnabled(const std::string& extension_id,
content::BrowserContext* context) {
const Extension* extension = ExtensionRegistry::Get(context)->
« chrome/browser/extensions/extension_util.h ('K') | « chrome/browser/extensions/extension_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698