| 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 "mojo/shell/network_fetcher.h" | 5 #include "mojo/shell/network_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 if (!file.IsValid()) { | 124 if (!file.IsValid()) { |
| 125 LOG(ERROR) << "Error reading " << path.value(); | 125 LOG(ERROR) << "Error reading " << path.value(); |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 // The output is really a vector of unit8, we're cheating by using a string. | 128 // The output is really a vector of unit8, we're cheating by using a string. |
| 129 std::string output(crypto::kSHA256Length, 0); | 129 std::string output(crypto::kSHA256Length, 0); |
| 130 ctx->Finish(string_as_array(&output), output.size()); | 130 ctx->Finish(string_as_array(&output), output.size()); |
| 131 output = base::HexEncode(output.c_str(), output.size()); | 131 output = base::HexEncode(output.c_str(), output.size()); |
| 132 // Using lowercase for compatiblity with sha256sum output. | 132 // Using lowercase for compatiblity with sha256sum output. |
| 133 *digest_string = base::StringToLowerASCII(output); | 133 *digest_string = base::ToLowerASCII(output); |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool NetworkFetcher::RenameToAppId(const GURL& url, | 137 bool NetworkFetcher::RenameToAppId(const GURL& url, |
| 138 const base::FilePath& old_path, | 138 const base::FilePath& old_path, |
| 139 base::FilePath* new_path) { | 139 base::FilePath* new_path) { |
| 140 std::string app_id; | 140 std::string app_id; |
| 141 if (!ComputeAppId(old_path, &app_id)) | 141 if (!ComputeAppId(old_path, &app_id)) |
| 142 return false; | 142 return false; |
| 143 | 143 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 loader_callback_.Run(nullptr); | 249 loader_callback_.Run(nullptr); |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 | 252 |
| 253 response_ = response.Pass(); | 253 response_ = response.Pass(); |
| 254 loader_callback_.Run(owner.Pass()); | 254 loader_callback_.Run(owner.Pass()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace shell | 257 } // namespace shell |
| 258 } // namespace mojo | 258 } // namespace mojo |
| OLD | NEW |