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/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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 base::TimeDelta::FromSeconds(config_->NextCheckDelay()), | 82 base::TimeDelta::FromSeconds(config_->NextCheckDelay()), |
83 base::Bind(base::IgnoreResult(&CrxUpdateService::CheckForUpdates), | 83 base::Bind(base::IgnoreResult(&CrxUpdateService::CheckForUpdates), |
84 base::Unretained(this))); | 84 base::Unretained(this))); |
85 } | 85 } |
86 | 86 |
87 // Stops the update loop. In flight operations will be completed. | 87 // Stops the update loop. In flight operations will be completed. |
88 void CrxUpdateService::Stop() { | 88 void CrxUpdateService::Stop() { |
89 DCHECK(thread_checker_.CalledOnValidThread()); | 89 DCHECK(thread_checker_.CalledOnValidThread()); |
90 VLOG(1) << "CrxUpdateService stopping"; | 90 VLOG(1) << "CrxUpdateService stopping"; |
91 timer_.Stop(); | 91 timer_.Stop(); |
92 update_client_->Stop(); | |
93 } | 92 } |
94 | 93 |
95 // Adds a component to be checked for upgrades. If the component exists it | 94 // Adds a component to be checked for upgrades. If the component exists it |
96 // it will be replaced. | 95 // it will be replaced. |
97 bool CrxUpdateService::RegisterComponent(const CrxComponent& component) { | 96 bool CrxUpdateService::RegisterComponent(const CrxComponent& component) { |
98 DCHECK(thread_checker_.CalledOnValidThread()); | 97 DCHECK(thread_checker_.CalledOnValidThread()); |
99 if (component.pk_hash.empty() || !component.version.IsValid() || | 98 if (component.pk_hash.empty() || !component.version.IsValid() || |
100 !component.installer) { | 99 !component.installer) { |
101 return false; | 100 return false; |
102 } | 101 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // TODO(sorin): consider making this a singleton. | 348 // TODO(sorin): consider making this a singleton. |
350 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( | 349 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( |
351 const scoped_refptr<Configurator>& config) { | 350 const scoped_refptr<Configurator>& config) { |
352 DCHECK(config); | 351 DCHECK(config); |
353 auto update_client = update_client::UpdateClientFactory(config); | 352 auto update_client = update_client::UpdateClientFactory(config); |
354 return scoped_ptr<ComponentUpdateService>( | 353 return scoped_ptr<ComponentUpdateService>( |
355 new CrxUpdateService(config, update_client.Pass())); | 354 new CrxUpdateService(config, update_client.Pass())); |
356 } | 355 } |
357 | 356 |
358 } // namespace component_updater | 357 } // namespace component_updater |
OLD | NEW |