summaryrefslogtreecommitdiff
path: root/chromium/components/metrics/motherboard.h
blob: c04dec013cd293112909329bbf00a332ae635256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_METRICS_MOTHERBOARD_H_
#define COMPONENTS_METRICS_MOTHERBOARD_H_

#include <string>

#include "third_party/abseil-cpp/absl/types/optional.h"

namespace metrics {

class Motherboard final {
 public:
  enum class BiosType { kLegacy, kUefi };
  Motherboard();
  Motherboard(Motherboard&&);
  Motherboard(const Motherboard&) = delete;
  ~Motherboard();

  // The fields below provide details about Motherboard and BIOS on the system.
  //
  // A `nullopt_t` means that the property does not exist/could not be read.
  // A valid value could be an UTF-8 string with characters or an empty string.
  //
  // This `absl::optional` can be mapped directly to the optional proto message
  // field, where the message field is added only if there is a valid value.
  const absl::optional<std::string>& manufacturer() const {
    return manufacturer_;
  }
  const absl::optional<std::string>& model() const { return model_; }
  const absl::optional<std::string>& bios_manufacturer() const {
    return bios_manufacturer_;
  }
  const absl::optional<std::string>& bios_version() const {
    return bios_version_;
  }
  absl::optional<BiosType> bios_type() const { return bios_type_; }

 private:
  absl::optional<std::string> manufacturer_;
  absl::optional<std::string> model_;
  absl::optional<std::string> bios_manufacturer_;
  absl::optional<std::string> bios_version_;
  absl::optional<BiosType> bios_type_;
};

}  // namespace metrics

#endif  // COMPONENTS_METRICS_MOTHERBOARD_H_