| 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(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Adds a component to be checked for upgrades. If the component exists it | 95 // Adds a component to be checked for upgrades. If the component exists it |
| 95 // it will be replaced. | 96 // it will be replaced. |
| 96 bool CrxUpdateService::RegisterComponent(const CrxComponent& component) { | 97 bool CrxUpdateService::RegisterComponent(const CrxComponent& component) { |
| 97 DCHECK(thread_checker_.CalledOnValidThread()); | 98 DCHECK(thread_checker_.CalledOnValidThread()); |
| 98 if (component.pk_hash.empty() || !component.version.IsValid() || | 99 if (component.pk_hash.empty() || !component.version.IsValid() || |
| 99 !component.installer) { | 100 !component.installer) { |
| 100 return false; | 101 return false; |
| 101 } | 102 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // TODO(sorin): consider making this a singleton. | 349 // TODO(sorin): consider making this a singleton. |
| 349 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( | 350 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( |
| 350 const scoped_refptr<Configurator>& config) { | 351 const scoped_refptr<Configurator>& config) { |
| 351 DCHECK(config); | 352 DCHECK(config); |
| 352 auto update_client = update_client::UpdateClientFactory(config); | 353 auto update_client = update_client::UpdateClientFactory(config); |
| 353 return scoped_ptr<ComponentUpdateService>( | 354 return scoped_ptr<ComponentUpdateService>( |
| 354 new CrxUpdateService(config, update_client.Pass())); | 355 new CrxUpdateService(config, update_client.Pass())); |
| 355 } | 356 } |
| 356 | 357 |
| 357 } // namespace component_updater | 358 } // namespace component_updater |
| OLD | NEW |