blob: 4671deaf006c990398ddc80b9327fca8ee822802 [file] [log] [blame]
Joshua Pawlicki0499ac82017-08-17 18:29:071// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_
6#define COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_
7
Hazem Ashmawy037270b2021-09-01 12:12:048#include <vector>
9
Joshua Pawlicki0499ac82017-08-17 18:29:0710#include "components/metrics/metrics_provider.h"
11
12namespace component_updater {
Hazem Ashmawy037270b2021-09-01 12:12:0413struct ComponentInfo;
Joshua Pawlicki0499ac82017-08-17 18:29:0714}
15
16namespace metrics {
17
18class SystemProfileProto;
19
Hazem Ashmawy037270b2021-09-01 12:12:0420// A delegate that returns a list of components that are loaded in the
21// system.
22class ComponentMetricsProviderDelegate {
23 public:
24 ComponentMetricsProviderDelegate() = default;
25 virtual ~ComponentMetricsProviderDelegate() = default;
26
27 virtual std::vector<component_updater::ComponentInfo> GetComponents() = 0;
28};
29
Joshua Pawlicki0499ac82017-08-17 18:29:0730// Stores and loads system information to prefs for stability logs.
31class ComponentMetricsProvider : public MetricsProvider {
32 public:
33 explicit ComponentMetricsProvider(
Hazem Ashmawy037270b2021-09-01 12:12:0434 std::unique_ptr<ComponentMetricsProviderDelegate>
35 components_info_delegate);
Peter Boström09c01822021-09-20 22:43:2736
37 ComponentMetricsProvider(const ComponentMetricsProvider&) = delete;
38 ComponentMetricsProvider& operator=(const ComponentMetricsProvider&) = delete;
39
Joshua Pawlicki0499ac82017-08-17 18:29:0740 ~ComponentMetricsProvider() override;
41
42 // MetricsProvider:
43 void ProvideSystemProfileMetrics(
44 SystemProfileProto* system_profile_proto) override;
45
46 private:
Hazem Ashmawy037270b2021-09-01 12:12:0447 std::unique_ptr<ComponentMetricsProviderDelegate> components_info_delegate_;
Joshua Pawlicki0499ac82017-08-17 18:29:0748};
49
50} // namespace metrics
51
52#endif // COMPONENTS_METRICS_COMPONENT_METRICS_PROVIDER_H_