| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/content_hash_fetcher.h" | 5 #include "extensions/browser/content_hash_fetcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 // Now iterate over all the paths in sorted order and compute the block hashes | 344 // Now iterate over all the paths in sorted order and compute the block hashes |
| 345 // for each one. | 345 // for each one. |
| 346 ComputedHashes::Writer writer; | 346 ComputedHashes::Writer writer; |
| 347 for (SortedFilePathSet::iterator i = paths.begin(); i != paths.end(); ++i) { | 347 for (SortedFilePathSet::iterator i = paths.begin(); i != paths.end(); ++i) { |
| 348 if (IsCancelled()) | 348 if (IsCancelled()) |
| 349 return false; | 349 return false; |
| 350 const base::FilePath& full_path = *i; | 350 const base::FilePath& full_path = *i; |
| 351 base::FilePath relative_path; | 351 base::FilePath relative_path; |
| 352 extension_path_.AppendRelativePath(full_path, &relative_path); | 352 extension_path_.AppendRelativePath(full_path, &relative_path); |
| 353 relative_path = relative_path.NormalizePathSeparatorsTo('/'); |
| 353 | 354 |
| 354 const std::string* expected_root = | 355 const std::string* expected_root = |
| 355 verified_contents.GetTreeHashRoot(relative_path); | 356 verified_contents.GetTreeHashRoot(relative_path); |
| 356 if (!expected_root) | 357 if (!expected_root) |
| 357 continue; | 358 continue; |
| 358 | 359 |
| 359 std::string contents; | 360 std::string contents; |
| 360 if (!base::ReadFileToString(full_path, &contents)) { | 361 if (!base::ReadFileToString(full_path, &contents)) { |
| 361 LOG(ERROR) << "Could not read " << full_path.MaybeAsASCII(); | 362 LOG(ERROR) << "Could not read " << full_path.MaybeAsASCII(); |
| 362 continue; | 363 continue; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 501 |
| 501 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { | 502 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { |
| 502 if (i->second.get() == job) { | 503 if (i->second.get() == job) { |
| 503 jobs_.erase(i); | 504 jobs_.erase(i); |
| 504 break; | 505 break; |
| 505 } | 506 } |
| 506 } | 507 } |
| 507 } | 508 } |
| 508 | 509 |
| 509 } // namespace extensions | 510 } // namespace extensions |
| OLD | NEW |