| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 next_command_ = commands_->begin(); | 71 next_command_ = commands_->begin(); |
| 72 PatchNextFile(); | 72 PatchNextFile(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ComponentPatcher::PatchNextFile() { | 76 void ComponentPatcher::PatchNextFile() { |
| 77 if (next_command_ == commands_->end()) { | 77 if (next_command_ == commands_->end()) { |
| 78 DonePatching(ComponentUnpacker::kNone, 0); | 78 DonePatching(ComponentUnpacker::kNone, 0); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 if (!(*next_command_)->IsType(base::Value::TYPE_DICTIONARY)) { | 81 const base::DictionaryValue* command_args; |
| 82 if (!(*next_command_)->GetAsDictionary(&command_args)) { |
| 82 DonePatching(ComponentUnpacker::kDeltaBadCommands, 0); | 83 DonePatching(ComponentUnpacker::kDeltaBadCommands, 0); |
| 83 return; | 84 return; |
| 84 } | 85 } |
| 85 const base::DictionaryValue* command_args = | |
| 86 static_cast<base::DictionaryValue*>(*next_command_); | |
| 87 | 86 |
| 88 std::string operation; | 87 std::string operation; |
| 89 if (command_args->GetString(kOp, &operation)) { | 88 if (command_args->GetString(kOp, &operation)) { |
| 90 current_operation_ = | 89 current_operation_ = |
| 91 CreateDeltaUpdateOp(operation, out_of_process_patcher_); | 90 CreateDeltaUpdateOp(operation, out_of_process_patcher_); |
| 92 } | 91 } |
| 93 | 92 |
| 94 if (!current_operation_.get()) { | 93 if (!current_operation_.get()) { |
| 95 DonePatching(ComponentUnpacker::kDeltaUnsupportedCommand, 0); | 94 DonePatching(ComponentUnpacker::kDeltaUnsupportedCommand, 0); |
| 96 return; | 95 return; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 113 | 112 |
| 114 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error, | 113 void ComponentPatcher::DonePatching(ComponentUnpacker::Error error, |
| 115 int extended_error) { | 114 int extended_error) { |
| 116 current_operation_ = NULL; | 115 current_operation_ = NULL; |
| 117 task_runner_->PostTask(FROM_HERE, | 116 task_runner_->PostTask(FROM_HERE, |
| 118 base::Bind(callback_, error, extended_error)); | 117 base::Bind(callback_, error, extended_error)); |
| 119 callback_.Reset(); | 118 callback_.Reset(); |
| 120 } | 119 } |
| 121 | 120 |
| 122 } // namespace update_client | 121 } // namespace update_client |
| OLD | NEW |