| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/action.h" | 5 #include "components/update_client/action.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void ActionImpl::UpdateCrx() { | 120 void ActionImpl::UpdateCrx() { |
| 121 DCHECK(thread_checker_.CalledOnValidThread()); | 121 DCHECK(thread_checker_.CalledOnValidThread()); |
| 122 DCHECK(!update_context_->queue.empty()); | 122 DCHECK(!update_context_->queue.empty()); |
| 123 | 123 |
| 124 const std::string& id = update_context_->queue.front(); | 124 const std::string& id = update_context_->queue.front(); |
| 125 CrxUpdateItem* item = FindUpdateItemById(id); | 125 CrxUpdateItem* item = FindUpdateItemById(id); |
| 126 DCHECK(item); | 126 DCHECK(item); |
| 127 | 127 |
| 128 item->update_begin = base::TimeTicks::Now(); | 128 item->update_begin = base::TimeTicks::Now(); |
| 129 | 129 |
| 130 if (item->component.supports_group_policy_enable_component_updates && |
| 131 !update_context_->config->EnabledComponentUpdates()) { |
| 132 item->error_category = |
| 133 static_cast<int>(Action::ErrorCategory::kServiceError); |
| 134 item->error_code = |
| 135 static_cast<int>(Action::ServiceError::ERROR_UPDATE_DISABLED); |
| 136 item->extra_code1 = 0; |
| 137 ChangeItemState(item, CrxUpdateItem::State::kNoUpdate); |
| 138 |
| 139 UpdateCrxComplete(item); |
| 140 return; |
| 141 } |
| 142 |
| 130 std::unique_ptr<Action> update_action( | 143 std::unique_ptr<Action> update_action( |
| 131 CanTryDiffUpdate(item, update_context_->config) | 144 CanTryDiffUpdate(item, update_context_->config) |
| 132 ? ActionUpdateDiff::Create() | 145 ? ActionUpdateDiff::Create() |
| 133 : ActionUpdateFull::Create()); | 146 : ActionUpdateFull::Create()); |
| 134 | 147 |
| 135 base::ThreadTaskRunnerHandle::Get()->PostTask( | 148 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 136 FROM_HERE, base::Bind(&Action::Run, base::Unretained(update_action.get()), | 149 FROM_HERE, base::Bind(&Action::Run, base::Unretained(update_action.get()), |
| 137 update_context_, callback_)); | 150 update_context_, callback_)); |
| 138 | 151 |
| 139 update_context_->current_action.reset(update_action.release()); | 152 update_context_->current_action.reset(update_action.release()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 186 } |
| 174 | 187 |
| 175 void ActionImpl::UpdateComplete(int error) { | 188 void ActionImpl::UpdateComplete(int error) { |
| 176 DCHECK(thread_checker_.CalledOnValidThread()); | 189 DCHECK(thread_checker_.CalledOnValidThread()); |
| 177 | 190 |
| 178 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 191 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 179 base::Bind(callback_, error)); | 192 base::Bind(callback_, error)); |
| 180 } | 193 } |
| 181 | 194 |
| 182 } // namespace update_client | 195 } // namespace update_client |
| OLD | NEW |