diff options
author | tfarina <tfarina@chromium.org> | 2015-04-04 07:35:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-04 14:35:47 +0000 |
commit | a1e804d26dd14e7baa983b3de52f0da1d9c9b3c1 (patch) | |
tree | f8f4995d06206f89aaad54bf3721a17fcfd1b14c /extensions/common/features | |
parent | 6e3c0446a84339e95996e9cafd6e5e72c0698827 (diff) | |
download | chromium_src-a1e804d26dd14e7baa983b3de52f0da1d9c9b3c1.zip chromium_src-a1e804d26dd14e7baa983b3de52f0da1d9c9b3c1.tar.gz chromium_src-a1e804d26dd14e7baa983b3de52f0da1d9c9b3c1.tar.bz2 |
extensions: Reuse crx_file's HashedIdInHex() function in SimpleFeature.
The implementation of HashExtensionId() is identical to the one in
id_util.h
BUG=384613
TEST=extensions_unittests
R=rockot@chromium.org
Review URL: https://codereview.chromium.org/1051413003
Cr-Commit-Position: refs/heads/master@{#323881}
Diffstat (limited to 'extensions/common/features')
-rw-r--r-- | extensions/common/features/simple_feature.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/extensions/common/features/simple_feature.cc b/extensions/common/features/simple_feature.cc index 6a5bece..34258d4 100644 --- a/extensions/common/features/simple_feature.cc +++ b/extensions/common/features/simple_feature.cc @@ -16,10 +16,13 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "components/crx_file/id_util.h" #include "extensions/common/extension_api.h" #include "extensions/common/features/feature_provider.h" #include "extensions/common/switches.h" +using crx_file::id_util::HashedIdInHex; + namespace extensions { namespace { @@ -207,12 +210,6 @@ std::string ListDisplayNames(const std::vector<EnumType>& enum_types) { return display_name_list; } -std::string HashExtensionId(const std::string& extension_id) { - const std::string id_hash = base::SHA1HashString(extension_id); - DCHECK_EQ(base::kSHA1Length, id_hash.length()); - return base::HexEncode(id_hash.c_str(), id_hash.length()); -} - bool IsCommandLineSwitchEnabled(const std::string& switch_name) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switch_name + "=1")) @@ -568,7 +565,7 @@ bool SimpleFeature::IsIdInArray(const std::string& extension_id, const char* const* end = array + array_length; return ((std::find(start, end, extension_id) != end) || - (std::find(start, end, HashExtensionId(extension_id)) != end)); + (std::find(start, end, HashedIdInHex(extension_id)) != end)); } // static @@ -578,7 +575,7 @@ bool SimpleFeature::IsIdInList(const std::string& extension_id, return false; return (ContainsValue(list, extension_id) || - ContainsValue(list, HashExtensionId(extension_id))); + ContainsValue(list, HashedIdInHex(extension_id))); } bool SimpleFeature::MatchesManifestLocation( |