| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/url_response_disk_cache/url_response_disk_cache_impl.h" | 5 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 task_runner->PostDelayedTask( | 76 task_runner->PostDelayedTask( |
| 77 FROM_HERE, | 77 FROM_HERE, |
| 78 base::Bind(base::IgnoreResult(&base::DeleteFile), trash_dir, true), | 78 base::Bind(base::IgnoreResult(&base::DeleteFile), trash_dir, true), |
| 79 base::TimeDelta::FromSeconds(kTrashDelayInSeconds)); | 79 base::TimeDelta::FromSeconds(kTrashDelayInSeconds)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 Array<uint8_t> PathToArray(const base::FilePath& path) { | 82 Array<uint8_t> PathToArray(const base::FilePath& path) { |
| 83 if (path.empty()) | 83 if (path.empty()) |
| 84 return Array<uint8_t>(); | 84 return Array<uint8_t>(); |
| 85 const std::string& string = path.value(); | 85 const std::string& string = path.value(); |
| 86 Array<uint8_t> result(string.size()); | 86 auto result = Array<uint8_t>::New(string.size()); |
| 87 memcpy(&result.front(), string.data(), string.size()); | 87 memcpy(&result.front(), string.data(), string.size()); |
| 88 return result.Pass(); | 88 return result.Pass(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // This method remove the query string of an url if one is present. It does | 91 // This method remove the query string of an url if one is present. It does |
| 92 // match the behavior of the application manager, which connects to the same app | 92 // match the behavior of the application manager, which connects to the same app |
| 93 // if requested twice with different query parameters. | 93 // if requested twice with different query parameters. |
| 94 std::string CanonicalizeURL(const std::string& url) { | 94 std::string CanonicalizeURL(const std::string& url) { |
| 95 GURL gurl(url); | 95 GURL gurl(url); |
| 96 | 96 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return; | 515 return; |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 // We can ignore write error, as it will just force to clear the cache on the | 518 // We can ignore write error, as it will just force to clear the cache on the |
| 519 // next request. | 519 // next request. |
| 520 WriteFile(GetExtractionSentinel(entry_directory), nullptr, 0); | 520 WriteFile(GetExtractionSentinel(entry_directory), nullptr, 0); |
| 521 callback.Run(extraction_directory, consumer_cache_directory); | 521 callback.Run(extraction_directory, consumer_cache_directory); |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace mojo | 524 } // namespace mojo |
| OLD | NEW |