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 "components/update_client/component_unpacker.h" | 5 #include "components/update_client/component_unpacker.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const base::FilePath& unpack_path) { | 42 const base::FilePath& unpack_path) { |
43 base::FilePath manifest = | 43 base::FilePath manifest = |
44 unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); | 44 unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); |
45 if (!base::PathExists(manifest)) | 45 if (!base::PathExists(manifest)) |
46 return std::unique_ptr<base::DictionaryValue>(); | 46 return std::unique_ptr<base::DictionaryValue>(); |
47 JSONFileValueDeserializer deserializer(manifest); | 47 JSONFileValueDeserializer deserializer(manifest); |
48 std::string error; | 48 std::string error; |
49 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); | 49 std::unique_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
50 if (!root.get()) | 50 if (!root.get()) |
51 return std::unique_ptr<base::DictionaryValue>(); | 51 return std::unique_ptr<base::DictionaryValue>(); |
52 if (!root->IsType(base::Value::TYPE_DICTIONARY)) | 52 if (!root->IsType(base::Value::Type::DICTIONARY)) |
53 return std::unique_ptr<base::DictionaryValue>(); | 53 return std::unique_ptr<base::DictionaryValue>(); |
54 return std::unique_ptr<base::DictionaryValue>( | 54 return std::unique_ptr<base::DictionaryValue>( |
55 static_cast<base::DictionaryValue*>(root.release())); | 55 static_cast<base::DictionaryValue*>(root.release())); |
56 } | 56 } |
57 | 57 |
58 ComponentUnpacker::Result::Result() {} | 58 ComponentUnpacker::Result::Result() {} |
59 | 59 |
60 ComponentUnpacker::ComponentUnpacker( | 60 ComponentUnpacker::ComponentUnpacker( |
61 const std::vector<uint8_t>& pk_hash, | 61 const std::vector<uint8_t>& pk_hash, |
62 const base::FilePath& path, | 62 const base::FilePath& path, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 Result result; | 181 Result result; |
182 result.error = error_; | 182 result.error = error_; |
183 result.extended_error = extended_error_; | 183 result.extended_error = extended_error_; |
184 if (error_ == UnpackerError::kNone) | 184 if (error_ == UnpackerError::kNone) |
185 result.unpack_path = unpack_path_; | 185 result.unpack_path = unpack_path_; |
186 | 186 |
187 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result)); | 187 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result)); |
188 } | 188 } |
189 | 189 |
190 } // namespace update_client | 190 } // namespace update_client |
OLD | NEW |