Roll src/third_party/WebKit b559582:d13e636 (svn 193437:193439)
[chromium-blink-merge.git] / components / metrics / machine_id_provider.h
blobd7fcc447639abeeb86d948933cb588e7f152741f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
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_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
13 namespace metrics {
15 // Provides machine characteristics used as a machine id. The implementation is
16 // platform specific with a default implementation that gives an empty id. The
17 // class is ref-counted thread safe so it can be used to post to the FILE thread
18 // and communicate back to the UI thread.
19 // This raw machine id should not be stored or transmitted over the network.
20 // TODO(jwd): Simplify implementation to get rid of the need for
21 // RefCountedThreadSafe (crbug.com/354882).
22 class MachineIdProvider : public base::RefCountedThreadSafe<MachineIdProvider> {
23 public:
24 // Get a string containing machine characteristics, to be used as a machine
25 // id. The implementation is platform specific, with a default implementation
26 // returning an empty string.
27 // The return value should not be stored to disk or transmitted.
28 std::string GetMachineId();
30 // Returns a pointer to a new MachineIdProvider or NULL if there is no
31 // provider implemented on a given platform. This is done to avoid posting a
32 // task to the FILE thread on platforms with no implementation.
33 static MachineIdProvider* CreateInstance();
35 private:
36 friend class base::RefCountedThreadSafe<MachineIdProvider>;
38 MachineIdProvider();
39 virtual ~MachineIdProvider();
41 DISALLOW_COPY_AND_ASSIGN(MachineIdProvider);
44 } // namespace metrics
46 #endif // COMPONENTS_METRICS_MACHINE_ID_PROVIDER_H_