| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 ids.push_back(it.first); | 193 ids.push_back(it.first); |
| 194 return ids; | 194 return ids; |
| 195 } | 195 } |
| 196 | 196 |
| 197 std::unique_ptr<ComponentInfo> CrxUpdateService::GetComponentForMimeType( | 197 std::unique_ptr<ComponentInfo> CrxUpdateService::GetComponentForMimeType( |
| 198 const std::string& mime_type) const { | 198 const std::string& mime_type) const { |
| 199 DCHECK(thread_checker_.CalledOnValidThread()); | 199 DCHECK(thread_checker_.CalledOnValidThread()); |
| 200 const auto it = component_ids_by_mime_type_.find(mime_type); | 200 const auto it = component_ids_by_mime_type_.find(mime_type); |
| 201 if (it == component_ids_by_mime_type_.end()) | 201 if (it == component_ids_by_mime_type_.end()) |
| 202 return nullptr; | 202 return nullptr; |
| 203 const auto component = GetComponent(it->second); | 203 auto* const component = GetComponent(it->second); |
| 204 if (!component) | 204 if (!component) |
| 205 return nullptr; | 205 return nullptr; |
| 206 return base::MakeUnique<ComponentInfo>(GetCrxComponentID(*component), | 206 return base::MakeUnique<ComponentInfo>(GetCrxComponentID(*component), |
| 207 base::UTF8ToUTF16(component->name), | 207 base::UTF8ToUTF16(component->name), |
| 208 component->version); | 208 component->version); |
| 209 } | 209 } |
| 210 | 210 |
| 211 OnDemandUpdater& CrxUpdateService::GetOnDemandUpdater() { | 211 OnDemandUpdater& CrxUpdateService::GetOnDemandUpdater() { |
| 212 DCHECK(thread_checker_.CalledOnValidThread()); | 212 DCHECK(thread_checker_.CalledOnValidThread()); |
| 213 return *this; | 213 return *this; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // is the job of the browser process. | 426 // is the job of the browser process. |
| 427 // TODO(sorin): consider making this a singleton. | 427 // TODO(sorin): consider making this a singleton. |
| 428 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( | 428 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( |
| 429 const scoped_refptr<Configurator>& config) { | 429 const scoped_refptr<Configurator>& config) { |
| 430 DCHECK(config); | 430 DCHECK(config); |
| 431 auto update_client = update_client::UpdateClientFactory(config); | 431 auto update_client = update_client::UpdateClientFactory(config); |
| 432 return base::MakeUnique<CrxUpdateService>(config, std::move(update_client)); | 432 return base::MakeUnique<CrxUpdateService>(config, std::move(update_client)); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace component_updater | 435 } // namespace component_updater |
| OLD | NEW |