[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / metrics / motherboard_metrics_provider.h
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.
4
5 #ifndef COMPONENTS_METRICS_MOTHERBOARD_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_MOTHERBOARD_METRICS_PROVIDER_H_
7
8 #include <memory>
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"
14
15 namespace metrics {
16
17 // MotherboardMetricsProvider adds Motherboard Info in the system profile. These
18 // include manufacturer and model.
19 class MotherboardMetricsProvider : public MetricsProvider {
20  public:
21   MotherboardMetricsProvider();
22   ~MotherboardMetricsProvider() override;
23
24   MotherboardMetricsProvider(const MotherboardMetricsProvider&) = delete;
25   MotherboardMetricsProvider& operator=(const MotherboardMetricsProvider&) =
26       delete;
27
28   // metrics::MetricsProvider:
29   void AsyncInit(base::OnceClosure done_callback) override;
30   void ProvideSystemProfileMetrics(
31       SystemProfileProto* system_profile_proto) override;
32
33  private:
34   // Initializes `motherboard_info_` on the UI thread.
35   void InitializeMotherboard(base::OnceClosure cb,
36                              std::unique_ptr<Motherboard> motherboard_info);
37
38   std::unique_ptr<const Motherboard> motherboard_info_;
39   base::WeakPtrFactory<MotherboardMetricsProvider> weak_ptr_factory_{this};
40 };
41
42 }  // namespace metrics
43
44 #endif  // COMPONENTS_METRICS_MOTHERBOARD_METRICS_PROVIDER_H_