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

Unified Diff: chrome/browser/sync/glue/extension_backed_data_type_controller.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
Index: chrome/browser/sync/glue/extension_backed_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/extension_backed_data_type_controller.cc b/chrome/browser/sync/glue/extension_backed_data_type_controller.cc
index 7de4d7e732c1de49a12507d536253c1249c14164..b24d76927cf00b15986dbd058ad1e17417a00912 100644
--- a/chrome/browser/sync/glue/extension_backed_data_type_controller.cc
+++ b/chrome/browser/sync/glue/extension_backed_data_type_controller.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/sync/glue/extension_backed_data_type_controller.h"
-#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_factory.h"
@@ -18,17 +18,6 @@ using content::BrowserThread;
namespace browser_sync {
-namespace {
-
-// Helper method to generate a hash from an extension id.
-std::string IdToHash(const std::string extension_id) {
- std::string hash = base::SHA1HashString(extension_id);
- hash = base::HexEncode(hash.c_str(), hash.length());
- return hash;
-}
-
-} // namespace
-
ExtensionBackedDataTypeController::ExtensionBackedDataTypeController(
syncer::ModelType type,
const std::string& extension_hash,
@@ -108,7 +97,7 @@ bool ExtensionBackedDataTypeController::IsSyncingExtensionEnabled() const {
bool ExtensionBackedDataTypeController::DoesExtensionMatch(
const extensions::Extension& extension) const {
- return IdToHash(extension.id()) == extension_hash_;
+ return crx_file::id_util::HashedIdInHex(extension.id()) == extension_hash_;
}
bool ExtensionBackedDataTypeController::StartModels() {
« no previous file with comments | « chrome/browser/extensions/external_component_loader.cc ('k') | chrome/browser/ui/bookmarks/enhanced_bookmark_key_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698