1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/component_updater/component_updater_utils.h"
10 #include "base/containers/flat_map.h"
11 #include "base/files/file_enumerator.h"
12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h"
14 #include "base/logging.h"
15 #include "base/version.h"
16 #include "components/component_updater/component_updater_service.h"
17 #include "third_party/abseil-cpp/absl/types/optional.h"
19 namespace component_updater {
21 absl::optional<ComponentRegistration> GetComponent(
22 const base::flat_map<std::string, ComponentRegistration>& components,
23 const std::string& id) {
24 const auto it = components.find(id);
25 if (it != components.end())
30 std::vector<absl::optional<ComponentRegistration>> GetCrxComponents(
31 const base::flat_map<std::string, ComponentRegistration>&
32 registered_components,
33 const std::vector<std::string>& ids) {
34 std::vector<absl::optional<ComponentRegistration>> components;
35 for (const auto& id : ids)
36 components.push_back(GetComponent(registered_components, id));
40 } // namespace component_updater