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

Unified Diff: components/crx_file/id_util.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 | « components/crx_file/id_util.h ('k') | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crx_file/id_util.cc
diff --git a/components/crx_file/id_util.cc b/components/crx_file/id_util.cc
index ef271ad1456a2ffa8b2405f87e3aa073a419dbb9..6209cb4a7342b3d4d4fd6af80e54df42ce9e5b16 100644
--- a/components/crx_file/id_util.cc
+++ b/components/crx_file/id_util.cc
@@ -5,6 +5,7 @@
#include "components/crx_file/id_util.h"
#include "base/files/file_path.h"
+#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "crypto/sha2.h"
@@ -53,6 +54,12 @@ std::string GenerateIdForPath(const base::FilePath& path) {
return GenerateId(path_bytes);
}
+std::string HashedIdInHex(const std::string& id) {
+ const std::string id_hash = base::SHA1HashString(id);
+ DCHECK_EQ(base::kSHA1Length, id_hash.length());
+ return base::HexEncode(id_hash.c_str(), id_hash.length());
+}
+
base::FilePath MaybeNormalizePath(const base::FilePath& path) {
#if defined(OS_WIN)
// Normalize any drive letter to upper-case. We do this for consistency with
« no previous file with comments | « components/crx_file/id_util.h ('k') | extensions/browser/api/app_window/app_window_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698