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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (!base::PathExists(manifest)) | 63 if (!base::PathExists(manifest)) |
64 return scoped_ptr<base::DictionaryValue>(); | 64 return scoped_ptr<base::DictionaryValue>(); |
65 JSONFileValueDeserializer deserializer(manifest); | 65 JSONFileValueDeserializer deserializer(manifest); |
66 std::string error; | 66 std::string error; |
67 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); | 67 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error); |
68 if (!root.get()) | 68 if (!root.get()) |
69 return scoped_ptr<base::DictionaryValue>(); | 69 return scoped_ptr<base::DictionaryValue>(); |
70 if (!root->IsType(base::Value::TYPE_DICTIONARY)) | 70 if (!root->IsType(base::Value::TYPE_DICTIONARY)) |
71 return scoped_ptr<base::DictionaryValue>(); | 71 return scoped_ptr<base::DictionaryValue>(); |
72 return scoped_ptr<base::DictionaryValue>( | 72 return scoped_ptr<base::DictionaryValue>( |
73 static_cast<base::DictionaryValue*>(root.release())).Pass(); | 73 static_cast<base::DictionaryValue*>(root.release())); |
74 } | 74 } |
75 | 75 |
76 bool ComponentUnpacker::UnpackInternal() { | 76 bool ComponentUnpacker::UnpackInternal() { |
77 return Verify() && Unzip() && BeginPatching(); | 77 return Verify() && Unzip() && BeginPatching(); |
78 } | 78 } |
79 | 79 |
80 void ComponentUnpacker::Unpack(const Callback& callback) { | 80 void ComponentUnpacker::Unpack(const Callback& callback) { |
81 callback_ = callback; | 81 callback_ = callback; |
82 if (!UnpackInternal()) | 82 if (!UnpackInternal()) |
83 Finish(); | 83 Finish(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!unpack_path_.empty()) | 207 if (!unpack_path_.empty()) |
208 base::DeleteFile(unpack_path_, true); | 208 base::DeleteFile(unpack_path_, true); |
209 task_runner_->PostTask(FROM_HERE, | 209 task_runner_->PostTask(FROM_HERE, |
210 base::Bind(callback_, error_, extended_error_)); | 210 base::Bind(callback_, error_, extended_error_)); |
211 } | 211 } |
212 | 212 |
213 ComponentUnpacker::~ComponentUnpacker() { | 213 ComponentUnpacker::~ComponentUnpacker() { |
214 } | 214 } |
215 | 215 |
216 } // namespace update_client | 216 } // namespace update_client |
OLD | NEW |