1 // Copyright 2014 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_MACHINE_ID_PROVIDER_H_
6 #define COMPONENTS_METRICS_MACHINE_ID_PROVIDER_H_
12 // Provides machine characteristics used as a machine id. The implementation is
13 // platform specific. GetMachineId() must be called on a thread which allows
14 // I/O. GetMachineId() must not be called if HasId() returns false on this
16 class MachineIdProvider {
18 MachineIdProvider() = delete;
19 MachineIdProvider(const MachineIdProvider&) = delete;
20 MachineIdProvider& operator=(const MachineIdProvider&) = delete;
22 // Returns true if this platform provides a non-empty GetMachineId(). This is
23 // useful to avoid an async call to GetMachineId() on platforms with no
27 // Get a string containing machine characteristics, to be used as a machine
28 // id. The implementation is split into Windows and non-Windows. The former
29 // returns the drive serial number and the latter returns the hardware
30 // model name. Should not be called if HasId() returns false.
31 // The return value should not be stored to disk or transmitted.
32 static std::string GetMachineId();
35 } // namespace metrics
37 #endif // COMPONENTS_METRICS_MACHINE_ID_PROVIDER_H_