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

Side by Side Diff: components/component_updater/component_updater_service.cc

Issue 2370923005: Implement restart-required message on Linux. (Closed)
Patch Set: Through #22 & sync Created 4 years, 2 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/component_updater/component_updater_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/component_updater/component_updater_service.h" 5 #include "components/component_updater/component_updater_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 UPDATE_TYPE_AUTOMATIC, 48 UPDATE_TYPE_AUTOMATIC,
49 UPDATE_TYPE_COUNT, 49 UPDATE_TYPE_COUNT,
50 }; 50 };
51 51
52 const char kRecoveryComponentId[] = "npdjjkjlcidkjlamlmmdelcjbcpdjocm"; 52 const char kRecoveryComponentId[] = "npdjjkjlcidkjlamlmmdelcjbcpdjocm";
53 53
54 } // namespace 54 } // namespace
55 55
56 namespace component_updater { 56 namespace component_updater {
57 57
58 ComponentInfo::ComponentInfo(const std::string& id, const base::string16& name) 58 ComponentInfo::ComponentInfo(const std::string& id, const base::string16& name,
59 : id(id), name(name) {} 59 const base::Version& version)
60 : id(id), name(name), version(version) {}
60 ComponentInfo::~ComponentInfo() {} 61 ComponentInfo::~ComponentInfo() {}
61 62
62 CrxUpdateService::CrxUpdateService( 63 CrxUpdateService::CrxUpdateService(
63 const scoped_refptr<Configurator>& config, 64 const scoped_refptr<Configurator>& config,
64 const scoped_refptr<UpdateClient>& update_client) 65 const scoped_refptr<UpdateClient>& update_client)
65 : config_(config), 66 : config_(config),
66 update_client_(update_client), 67 update_client_(update_client),
67 blocking_task_runner_(config->GetSequencedTaskRunner()) { 68 blocking_task_runner_(config->GetSequencedTaskRunner()) {
68 AddObserver(this); 69 AddObserver(this);
69 } 70 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 std::unique_ptr<ComponentInfo> CrxUpdateService::GetComponentForMimeType( 201 std::unique_ptr<ComponentInfo> CrxUpdateService::GetComponentForMimeType(
201 const std::string& mime_type) const { 202 const std::string& mime_type) const {
202 DCHECK(thread_checker_.CalledOnValidThread()); 203 DCHECK(thread_checker_.CalledOnValidThread());
203 const auto it = component_ids_by_mime_type_.find(mime_type); 204 const auto it = component_ids_by_mime_type_.find(mime_type);
204 if (it == component_ids_by_mime_type_.end()) 205 if (it == component_ids_by_mime_type_.end())
205 return nullptr; 206 return nullptr;
206 const auto component = GetComponent(it->second); 207 const auto component = GetComponent(it->second);
207 if (!component) 208 if (!component)
208 return nullptr; 209 return nullptr;
209 return base::MakeUnique<ComponentInfo>(GetCrxComponentID(*component), 210 return base::MakeUnique<ComponentInfo>(GetCrxComponentID(*component),
210 base::UTF8ToUTF16(component->name)); 211 base::UTF8ToUTF16(component->name),
212 component->version);
211 } 213 }
212 214
213 OnDemandUpdater& CrxUpdateService::GetOnDemandUpdater() { 215 OnDemandUpdater& CrxUpdateService::GetOnDemandUpdater() {
214 DCHECK(thread_checker_.CalledOnValidThread()); 216 DCHECK(thread_checker_.CalledOnValidThread());
215 return *this; 217 return *this;
216 } 218 }
217 219
218 const CrxComponent* CrxUpdateService::GetComponent( 220 const CrxComponent* CrxUpdateService::GetComponent(
219 const std::string& id) const { 221 const std::string& id) const {
220 DCHECK(thread_checker_.CalledOnValidThread()); 222 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // is the job of the browser process. 456 // is the job of the browser process.
455 // TODO(sorin): consider making this a singleton. 457 // TODO(sorin): consider making this a singleton.
456 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( 458 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
457 const scoped_refptr<Configurator>& config) { 459 const scoped_refptr<Configurator>& config) {
458 DCHECK(config); 460 DCHECK(config);
459 auto update_client = update_client::UpdateClientFactory(config); 461 auto update_client = update_client::UpdateClientFactory(config);
460 return base::MakeUnique<CrxUpdateService>(config, std::move(update_client)); 462 return base::MakeUnique<CrxUpdateService>(config, std::move(update_client));
461 } 463 }
462 464
463 } // namespace component_updater 465 } // namespace component_updater
OLDNEW
« no previous file with comments | « components/component_updater/component_updater_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698