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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // extension unpacker will reject, so that a component cannot be installed | 56 // extension unpacker will reject, so that a component cannot be installed |
57 // as an extension. | 57 // as an extension. |
58 scoped_ptr<base::DictionaryValue> ReadManifest( | 58 scoped_ptr<base::DictionaryValue> ReadManifest( |
59 const base::FilePath& unpack_path) { | 59 const base::FilePath& unpack_path) { |
60 base::FilePath manifest = | 60 base::FilePath manifest = |
61 unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); | 61 unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); |
62 if (!base::PathExists(manifest)) | 62 if (!base::PathExists(manifest)) |
63 return scoped_ptr<base::DictionaryValue>(); | 63 return scoped_ptr<base::DictionaryValue>(); |
64 JSONFileValueDeserializer deserializer(manifest); | 64 JSONFileValueDeserializer deserializer(manifest); |
65 std::string error; | 65 std::string error; |
66 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); | 66 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
67 if (!root.get()) | 67 if (!root.get()) |
68 return scoped_ptr<base::DictionaryValue>(); | 68 return scoped_ptr<base::DictionaryValue>(); |
69 if (!root->IsType(base::Value::TYPE_DICTIONARY)) | 69 if (!root->IsType(base::Value::TYPE_DICTIONARY)) |
70 return scoped_ptr<base::DictionaryValue>(); | 70 return scoped_ptr<base::DictionaryValue>(); |
71 return scoped_ptr<base::DictionaryValue>( | 71 return scoped_ptr<base::DictionaryValue>( |
72 static_cast<base::DictionaryValue*>(root.release())).Pass(); | 72 static_cast<base::DictionaryValue*>(root.release())).Pass(); |
73 } | 73 } |
74 | 74 |
75 bool ComponentUnpacker::UnpackInternal() { | 75 bool ComponentUnpacker::UnpackInternal() { |
76 return Verify() && Unzip() && BeginPatching(); | 76 return Verify() && Unzip() && BeginPatching(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!unpack_path_.empty()) | 206 if (!unpack_path_.empty()) |
207 base::DeleteFile(unpack_path_, true); | 207 base::DeleteFile(unpack_path_, true); |
208 task_runner_->PostTask(FROM_HERE, | 208 task_runner_->PostTask(FROM_HERE, |
209 base::Bind(callback_, error_, extended_error_)); | 209 base::Bind(callback_, error_, extended_error_)); |
210 } | 210 } |
211 | 211 |
212 ComponentUnpacker::~ComponentUnpacker() { | 212 ComponentUnpacker::~ComponentUnpacker() { |
213 } | 213 } |
214 | 214 |
215 } // namespace update_client | 215 } // namespace update_client |
OLD | NEW |