• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_H_
6 #define COMPONENTS_METRICS_MOTHERBOARD_H_
7 
8 #include <string>
9 
10 #include "third_party/abseil-cpp/absl/types/optional.h"
11 
12 namespace metrics {
13 
14 class Motherboard final {
15  public:
16   enum class BiosType { kLegacy, kUefi };
17   Motherboard();
18   Motherboard(Motherboard&&);
19   Motherboard(const Motherboard&) = delete;
20   ~Motherboard();
21 
22   // The fields below provide details about Motherboard and BIOS on the system.
23   //
24   // A `nullopt_t` means that the property does not exist/could not be read.
25   // A valid value could be an UTF-8 string with characters or an empty string.
26   //
27   // This `absl::optional` can be mapped directly to the optional proto message
28   // field, where the message field is added only if there is a valid value.
manufacturer()29   const absl::optional<std::string>& manufacturer() const {
30     return manufacturer_;
31   }
model()32   const absl::optional<std::string>& model() const { return model_; }
bios_manufacturer()33   const absl::optional<std::string>& bios_manufacturer() const {
34     return bios_manufacturer_;
35   }
bios_version()36   const absl::optional<std::string>& bios_version() const {
37     return bios_version_;
38   }
bios_type()39   absl::optional<BiosType> bios_type() const { return bios_type_; }
40 
41  private:
42   absl::optional<std::string> manufacturer_;
43   absl::optional<std::string> model_;
44   absl::optional<std::string> bios_manufacturer_;
45   absl::optional<std::string> bios_version_;
46   absl::optional<BiosType> bios_type_;
47 };
48 
49 }  // namespace metrics
50 
51 #endif  // COMPONENTS_METRICS_MOTHERBOARD_H_
52