Index: chrome/browser/component_updater/component_patcher.cc |
diff --git a/chrome/browser/component_updater/component_patcher.cc b/chrome/browser/component_updater/component_patcher.cc |
index de082a74296bc9b10196dfc11706fbfc246d465a..9bef02ecb6e8c539667bdbc5c0f96ce9c057f805 100644 |
--- a/chrome/browser/component_updater/component_patcher.cc |
+++ b/chrome/browser/component_updater/component_patcher.cc |
@@ -36,46 +36,54 @@ base::ListValue* ReadCommands(const base::FilePath& unpack_path) { |
// The patching support is not cross-platform at the moment. |
ComponentPatcherCrossPlatform::ComponentPatcherCrossPlatform() {} |
-ComponentUnpacker::Error ComponentPatcherCrossPlatform::Patch( |
+component_updater::Error ComponentPatcherCrossPlatform::Patch( |
PatchType patch_type, |
const base::FilePath& input_file, |
const base::FilePath& patch_file, |
const base::FilePath& output_file, |
int* error) { |
- return ComponentUnpacker::kDeltaUnsupportedCommand; |
+ return component_updater::kDeltaUnsupportedCommand; |
} |
// Takes the contents of a differential component update in input_dir |
// and produces the contents of a full component update in unpack_dir |
// using input_abs_path_ files that the installer knows about. |
-ComponentUnpacker::Error DifferentialUpdatePatch( |
+void DifferentialUpdatePatch( |
const base::FilePath& input_dir, |
const base::FilePath& unpack_dir, |
ComponentPatcher* patcher, |
ComponentInstaller* installer, |
- int* error) { |
- *error = 0; |
+ base::Callback<void(component_updater::Error, int)> callback) { |
+ int error = 0; |
scoped_ptr<base::ListValue> commands(ReadCommands(input_dir)); |
- if (!commands.get()) |
- return ComponentUnpacker::kDeltaBadCommands; |
+ if (!commands.get()) { |
+ callback.Run(component_updater::kDeltaBadCommands, error); |
+ return; |
+ } |
for (base::ValueVector::const_iterator command = commands->begin(), |
end = commands->end(); command != end; command++) { |
- if (!(*command)->IsType(base::Value::TYPE_DICTIONARY)) |
- return ComponentUnpacker::kDeltaBadCommands; |
+ if (!(*command)->IsType(base::Value::TYPE_DICTIONARY)) { |
+ callback.Run(component_updater::kDeltaBadCommands, error); |
+ return; |
+ } |
base::DictionaryValue* command_args = |
static_cast<base::DictionaryValue*>(*command); |
scoped_ptr<DeltaUpdateOp> operation(CreateDeltaUpdateOp(command_args)); |
- if (!operation) |
- return ComponentUnpacker::kDeltaUnsupportedCommand; |
- |
- ComponentUnpacker::Error result = operation->Run( |
- command_args, input_dir, unpack_dir, patcher, installer, error); |
- if (result != ComponentUnpacker::kNone) |
- return result; |
+ if (!operation) { |
+ callback.Run(component_updater::kDeltaUnsupportedCommand, error); |
+ return; |
+ } |
+ |
+ component_updater::Error result = operation->Run( |
+ command_args, input_dir, unpack_dir, patcher, installer, &error); |
+ if (result != component_updater::kNone) { |
+ callback.Run(result, error); |
+ return; |
+ } |
} |
- return ComponentUnpacker::kNone; |
+ callback.Run(component_updater::kNone, error); |
} |