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

Unified Diff: extensions/browser/computed_hashes.cc

Issue 361523002: Fix some more problems with windows paths in content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/chrome_tests_unit.gypi ('k') | extensions/browser/computed_hashes_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/computed_hashes.cc
diff --git a/extensions/browser/computed_hashes.cc b/extensions/browser/computed_hashes.cc
index 4a8a8527206a6baaddc98e99b8999de2f4eb5869..a4eb9565c8ec517c3e3cb47b628646bf1b9778c3 100644
--- a/extensions/browser/computed_hashes.cc
+++ b/extensions/browser/computed_hashes.cc
@@ -57,6 +57,7 @@ bool ComputedHashes::Reader::InitFromFile(const base::FilePath& path) {
base::FilePath relative_path =
base::FilePath::FromUTF8Unsafe(relative_path_utf8);
+ relative_path = relative_path.NormalizePathSeparatorsTo('/');
data_[relative_path] = HashInfo(block_size, std::vector<std::string>());
std::vector<std::string>* hashes = &(data_[relative_path].second);
@@ -80,7 +81,8 @@ bool ComputedHashes::Reader::InitFromFile(const base::FilePath& path) {
bool ComputedHashes::Reader::GetHashes(const base::FilePath& relative_path,
int* block_size,
std::vector<std::string>* hashes) {
- std::map<base::FilePath, HashInfo>::iterator i = data_.find(relative_path);
+ base::FilePath path = relative_path.NormalizePathSeparatorsTo('/');
+ std::map<base::FilePath, HashInfo>::iterator i = data_.find(path);
if (i == data_.end())
return false;
HashInfo& info = i->second;
@@ -100,7 +102,8 @@ void ComputedHashes::Writer::AddHashes(const base::FilePath& relative_path,
base::DictionaryValue* dict = new base::DictionaryValue();
base::ListValue* block_hashes = new base::ListValue();
file_list_.Append(dict);
- dict->SetString(kPathKey, relative_path.AsUTF8Unsafe());
+ dict->SetString(kPathKey,
+ relative_path.NormalizePathSeparatorsTo('/').AsUTF8Unsafe());
dict->SetInteger(kBlockSizeKey, block_size);
dict->Set(kBlockHashesKey, block_hashes);
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | extensions/browser/computed_hashes_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698