OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ |
6 #define CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ | 6 #define CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "components/metrics/metrics_provider.h" | 14 #include "components/metrics/metrics_provider.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 class ExtensionSet; | 19 class ExtensionSet; |
20 } | 20 } |
21 | 21 |
22 namespace metrics { | 22 namespace metrics { |
23 class MetricsStateManager; | 23 class MetricsStateManager; |
(...skipping 12 matching lines...) Expand all Loading... |
36 ~ExtensionsMetricsProvider() override; | 36 ~ExtensionsMetricsProvider() override; |
37 | 37 |
38 // metrics::MetricsProvider: | 38 // metrics::MetricsProvider: |
39 void ProvideSystemProfileMetrics( | 39 void ProvideSystemProfileMetrics( |
40 metrics::SystemProfileProto* system_profile) override; | 40 metrics::SystemProfileProto* system_profile) override; |
41 | 41 |
42 protected: | 42 protected: |
43 // Exposed for the sake of mocking in test code. | 43 // Exposed for the sake of mocking in test code. |
44 | 44 |
45 // Retrieves the set of extensions installed in the given |profile|. | 45 // Retrieves the set of extensions installed in the given |profile|. |
46 virtual scoped_ptr<extensions::ExtensionSet> GetInstalledExtensions( | 46 virtual std::unique_ptr<extensions::ExtensionSet> GetInstalledExtensions( |
47 Profile* profile); | 47 Profile* profile); |
48 | 48 |
49 // Retrieves the client ID. | 49 // Retrieves the client ID. |
50 virtual uint64_t GetClientID(); | 50 virtual uint64_t GetClientID(); |
51 | 51 |
52 // Hashes the extension extension ID using the provided client key (which | 52 // Hashes the extension extension ID using the provided client key (which |
53 // must be less than kExtensionListClientKeys) and to produce an output value | 53 // must be less than kExtensionListClientKeys) and to produce an output value |
54 // between 0 and kExtensionListBuckets-1. | 54 // between 0 and kExtensionListBuckets-1. |
55 static int HashExtension(const std::string& extension_id, | 55 static int HashExtension(const std::string& extension_id, |
56 uint32_t client_key); | 56 uint32_t client_key); |
(...skipping 16 matching lines...) Expand all Loading... |
73 | 73 |
74 // The profile for which extensions are gathered for the occupied bucket | 74 // The profile for which extensions are gathered for the occupied bucket |
75 // metric. Once a profile is found its value is cached here so that | 75 // metric. Once a profile is found its value is cached here so that |
76 // GetMetricsProfile() can return a consistent value. | 76 // GetMetricsProfile() can return a consistent value. |
77 Profile* cached_profile_; | 77 Profile* cached_profile_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(ExtensionsMetricsProvider); | 79 DISALLOW_COPY_AND_ASSIGN(ExtensionsMetricsProvider); |
80 }; | 80 }; |
81 | 81 |
82 #endif // CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ | 82 #endif // CHROME_BROWSER_METRICS_EXTENSIONS_METRICS_PROVIDER_H_ |
OLD | NEW |