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_patcher.h" | 5 #include "components/update_client/component_patcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Deserialize the commands file (present in delta update packages). The top | 25 // Deserialize the commands file (present in delta update packages). The top |
26 // level must be a list. | 26 // level must be a list. |
27 base::ListValue* ReadCommands(const base::FilePath& unpack_path) { | 27 base::ListValue* ReadCommands(const base::FilePath& unpack_path) { |
28 const base::FilePath commands = | 28 const base::FilePath commands = |
29 unpack_path.Append(FILE_PATH_LITERAL("commands.json")); | 29 unpack_path.Append(FILE_PATH_LITERAL("commands.json")); |
30 if (!base::PathExists(commands)) | 30 if (!base::PathExists(commands)) |
31 return NULL; | 31 return NULL; |
32 | 32 |
33 JSONFileValueSerializer serializer(commands); | 33 JSONFileValueDeserializer deserializer(commands); |
34 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); | 34 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, NULL)); |
35 | 35 |
36 return (root.get() && root->IsType(base::Value::TYPE_LIST)) | 36 return (root.get() && root->IsType(base::Value::TYPE_LIST)) |
37 ? static_cast<base::ListValue*>(root.release()) | 37 ? static_cast<base::ListValue*>(root.release()) |
38 : NULL; | 38 : NULL; |
39 } | 39 } |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 ComponentPatcher::ComponentPatcher( | 43 ComponentPatcher::ComponentPatcher( |
44 const base::FilePath& input_dir, | 44 const base::FilePath& input_dir, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error, | 114 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error, |
115 int extended_error) { | 115 int extended_error) { |
116 current_operation_ = NULL; | 116 current_operation_ = NULL; |
117 task_runner_->PostTask(FROM_HERE, | 117 task_runner_->PostTask(FROM_HERE, |
118 base::Bind(callback_, error, extended_error)); | 118 base::Bind(callback_, error, extended_error)); |
119 callback_.Reset(); | 119 callback_.Reset(); |
120 } | 120 } |
121 | 121 |
122 } // namespace update_client | 122 } // namespace update_client |
OLD | NEW |