| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/component_updater/component_patcher.h" | 5 #include "chrome/browser/component_updater/component_patcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/json/json_file_value_serializer.h" | 11 #include "base/json/json_file_value_serializer.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/component_updater/component_patcher_operation.h" | 13 #include "chrome/browser/component_updater/component_patcher_operation.h" |
| 14 #include "chrome/browser/component_updater/component_updater_service.h" | 14 #include "chrome/browser/component_updater/component_updater_service.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Deserialize the commands file (present in delta update packages). The top | 18 // Deserialize the commands file (present in delta update packages). The top |
| 19 // level must be a list. | 19 // level must be a list. |
| 20 base::ListValue* ReadCommands(const base::FilePath& unpack_path) { | 20 base::ListValue* ReadCommands(const base::FilePath& unpack_path) { |
| 21 const base::FilePath commands = | 21 const base::FilePath commands = |
| 22 unpack_path.Append(FILE_PATH_LITERAL("commands.json")); | 22 unpack_path.Append(FILE_PATH_LITERAL("commands.json")); |
| 23 if (!file_util::PathExists(commands)) | 23 if (!base::PathExists(commands)) |
| 24 return NULL; | 24 return NULL; |
| 25 | 25 |
| 26 JSONFileValueSerializer serializer(commands); | 26 JSONFileValueSerializer serializer(commands); |
| 27 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); | 27 scoped_ptr<base::Value> root(serializer.Deserialize(NULL, NULL)); |
| 28 | 28 |
| 29 return (root.get() && root->IsType(base::Value::TYPE_LIST)) ? | 29 return (root.get() && root->IsType(base::Value::TYPE_LIST)) ? |
| 30 static_cast<base::ListValue*>(root.release()) : NULL; | 30 static_cast<base::ListValue*>(root.release()) : NULL; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 ComponentUnpacker::Error result = operation->Run( | 73 ComponentUnpacker::Error result = operation->Run( |
| 74 command_args, input_dir, unpack_dir, patcher, installer, error); | 74 command_args, input_dir, unpack_dir, patcher, installer, error); |
| 75 if (result != ComponentUnpacker::kNone) | 75 if (result != ComponentUnpacker::kNone) |
| 76 return result; | 76 return result; |
| 77 } | 77 } |
| 78 | 78 |
| 79 return ComponentUnpacker::kNone; | 79 return ComponentUnpacker::kNone; |
| 80 } | 80 } |
| 81 | 81 |
| OLD | NEW |