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 "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 case CrxUpdateItem::State::kLastStatus: | 93 case CrxUpdateItem::State::kLastStatus: |
94 // No notification for these states. | 94 // No notification for these states. |
95 break; | 95 break; |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 size_t ActionImpl::ChangeAllItemsState(CrxUpdateItem::State from, | 99 size_t ActionImpl::ChangeAllItemsState(CrxUpdateItem::State from, |
100 CrxUpdateItem::State to) { | 100 CrxUpdateItem::State to) { |
101 DCHECK(thread_checker_.CalledOnValidThread()); | 101 DCHECK(thread_checker_.CalledOnValidThread()); |
102 size_t count = 0; | 102 size_t count = 0; |
103 for (auto item : update_context_->update_items) { | 103 for (auto* item : update_context_->update_items) { |
104 if (item->state == from) { | 104 if (item->state == from) { |
105 ChangeItemState(item, to); | 105 ChangeItemState(item, to); |
106 ++count; | 106 ++count; |
107 } | 107 } |
108 } | 108 } |
109 return count; | 109 return count; |
110 } | 110 } |
111 | 111 |
112 void ActionImpl::NotifyObservers(UpdateClient::Observer::Events event, | 112 void ActionImpl::NotifyObservers(UpdateClient::Observer::Events event, |
113 const std::string& id) { | 113 const std::string& id) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 void ActionImpl::UpdateComplete(int error) { | 161 void ActionImpl::UpdateComplete(int error) { |
162 DCHECK(thread_checker_.CalledOnValidThread()); | 162 DCHECK(thread_checker_.CalledOnValidThread()); |
163 | 163 |
164 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 164 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
165 base::Bind(callback_, error)); | 165 base::Bind(callback_, error)); |
166 } | 166 } |
167 | 167 |
168 } // namespace update_client | 168 } // namespace update_client |
OLD | NEW |