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

Unified Diff: chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc

Issue 850853002: Extensions: Consolidate extension id hashing / searching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 11 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/sync/glue/extension_backed_data_type_controller.cc ('k') | components/crx_file/id_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc
diff --git a/chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc b/chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc
index ff39e07dfe7d5c8e6498edcc77f375dcd1df0a5c..755600b0e609685b821e68fd0e0c1651962837a5 100644
--- a/chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc
+++ b/chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc
@@ -6,13 +6,13 @@
#include <algorithm>
-#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/accelerator_utils.h"
#include "chrome/common/extensions/command.h"
+#include "components/crx_file/id_util.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/manifest_constants.h"
@@ -74,12 +74,12 @@ EnhancedBookmarkKeyService::GetEnhancedBookmarkExtension() const {
extensions::ExtensionSet::const_iterator loc =
std::find_if(extensions.begin(), extensions.end(),
[](scoped_refptr<const extensions::Extension> extension) {
- static const char enhanced_extension_hash[] =
+ static const char enhanced_ext_hash[] =
// http://crbug.com/312900
"D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2";
- std::string hash = base::SHA1HashString(extension->id());
- return base::HexEncode(hash.c_str(), hash.length()) ==
- enhanced_extension_hash;
+ std::string hashed_id =
+ crx_file::id_util::HashedIdInHex(extension->id());
+ return hashed_id == enhanced_ext_hash;
});
return loc != extensions.end() ? loc->get() : nullptr;
}
« no previous file with comments | « chrome/browser/sync/glue/extension_backed_data_type_controller.cc ('k') | components/crx_file/id_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698