Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: components/update_client/action.cc

Issue 2206583007: Handle the case when the updates are disabled for a component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/update_client/action.h ('k') | components/update_client/test_configurator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/update_client/action.h ('k') | components/update_client/test_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698