1 // Copyright 2022 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_MOTHERBOARD_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_MOTHERBOARD_METRICS_PROVIDER_H_
9 #include "base/functional/callback.h"
10 #include "base/memory/weak_ptr.h"
11 #include "components/metrics/metrics_provider.h"
12 #include "components/metrics/motherboard.h"
13 #include "third_party/metrics_proto/system_profile.pb.h"
17 // MotherboardMetricsProvider adds Motherboard Info in the system profile. These
18 // include manufacturer and model.
19 class MotherboardMetricsProvider : public MetricsProvider {
21 MotherboardMetricsProvider();
22 ~MotherboardMetricsProvider() override;
24 MotherboardMetricsProvider(const MotherboardMetricsProvider&) = delete;
25 MotherboardMetricsProvider& operator=(const MotherboardMetricsProvider&) =
28 // metrics::MetricsProvider:
29 void AsyncInit(base::OnceClosure done_callback) override;
30 void ProvideSystemProfileMetrics(
31 SystemProfileProto* system_profile_proto) override;
34 // Initializes `motherboard_info_` on the UI thread.
35 void InitializeMotherboard(base::OnceClosure cb,
36 std::unique_ptr<Motherboard> motherboard_info);
38 std::unique_ptr<const Motherboard> motherboard_info_;
39 base::WeakPtrFactory<MotherboardMetricsProvider> weak_ptr_factory_{this};
42 } // namespace metrics
44 #endif // COMPONENTS_METRICS_MOTHERBOARD_METRICS_PROVIDER_H_