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

Unified Diff: extensions/common/extension.cc

Issue 850853002: Extensions: Consolidate extension id hashing / searching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « extensions/common/extension.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension.cc
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index b721406701d0732e6fd83eec12798d41024cb329..8572b0c42c8e6fa31797d3e148b901b9d1662848 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -11,6 +11,7 @@
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
+#include "base/sha1.h"
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
@@ -390,6 +391,12 @@ const std::string Extension::GetVersionForDisplay() const {
return VersionString();
}
+std::string Extension::HashedIdInHex() const {
Yoyo Zhou 2015/01/22 00:59:13 Can this go in id_util.h instead of extension.h?
+ 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());
+}
+
void Extension::AddInstallWarning(const InstallWarning& new_warning) {
install_warnings_.push_back(new_warning);
}
« no previous file with comments | « extensions/common/extension.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698