1 // Copyright 2017 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 #ifndef COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_
10 #include "components/metrics/metrics_provider.h"
12 namespace component_updater {
18 class SystemProfileProto;
20 // A delegate that returns a list of components that are loaded in the
22 class ComponentMetricsProviderDelegate {
24 ComponentMetricsProviderDelegate() = default;
25 virtual ~ComponentMetricsProviderDelegate() = default;
27 virtual std::vector<component_updater::ComponentInfo> GetComponents() = 0;
30 // Stores and loads system information to prefs for stability logs.
31 class ComponentMetricsProvider : public MetricsProvider {
33 explicit ComponentMetricsProvider(
34 std::unique_ptr<ComponentMetricsProviderDelegate>
35 components_info_delegate);
37 ComponentMetricsProvider(const ComponentMetricsProvider&) = delete;
38 ComponentMetricsProvider& operator=(const ComponentMetricsProvider&) = delete;
40 ~ComponentMetricsProvider() override;
43 void ProvideSystemProfileMetrics(
44 SystemProfileProto* system_profile_proto) override;
47 std::unique_ptr<ComponentMetricsProviderDelegate> components_info_delegate_;
50 } // namespace metrics
52 #endif // COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_