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 COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 5 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
6 #define COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 6 #define COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/metrics/proto/system_profile.pb.h" | 16 #include "components/metrics/proto/system_profile.pb.h" |
17 | 17 |
18 namespace base { | |
19 class FilePath; | |
20 } | |
21 | |
18 namespace metrics { | 22 namespace metrics { |
19 | 23 |
20 class MetricsLogUploader; | 24 class MetricsLogUploader; |
25 class MetricsService; | |
21 | 26 |
22 // An abstraction of operations that depend on the embedder's (e.g. Chrome) | 27 // An abstraction of operations that depend on the embedder's (e.g. Chrome) |
23 // environment. | 28 // environment. |
24 class MetricsServiceClient { | 29 class MetricsServiceClient { |
25 public: | 30 public: |
26 virtual ~MetricsServiceClient() {} | 31 virtual ~MetricsServiceClient() {} |
27 | 32 |
33 // Returns the MetricsService instance that this client is associated with. | |
34 // With the exception of testing contexts, the returned instance must be valid | |
35 // for the lifetime of this object (typically, the embedder's client | |
36 // implementation will own the MetricsService instance being returned). | |
37 virtual metrics::MetricsService* GetMetricsService() = 0; | |
Alexei Svitkine (slow)
2015/10/20 15:02:20
Nit: Remove metrics:: since this is in it.
| |
38 | |
28 // Registers the client id with other services (e.g. crash reporting), called | 39 // Registers the client id with other services (e.g. crash reporting), called |
29 // when metrics recording gets enabled. | 40 // when metrics recording gets enabled. |
30 virtual void SetMetricsClientId(const std::string& client_id) = 0; | 41 virtual void SetMetricsClientId(const std::string& client_id) = 0; |
31 | 42 |
32 // Notifies the client that recording is disabled, so that other services | 43 // Notifies the client that recording is disabled, so that other services |
33 // (such as crash reporting) can clear any association with metrics. | 44 // (such as crash reporting) can clear any association with metrics. |
34 virtual void OnRecordingDisabled() = 0; | 45 virtual void OnRecordingDisabled() = 0; |
35 | 46 |
36 // Whether there's an "off the record" (aka "Incognito") session active. | 47 // Whether there's an "off the record" (aka "Incognito") session active. |
37 virtual bool IsOffTheRecordSessionActive() = 0; | 48 virtual bool IsOffTheRecordSessionActive() = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 // MetricsLogUploader for details). | 83 // MetricsLogUploader for details). |
73 virtual scoped_ptr<MetricsLogUploader> CreateUploader( | 84 virtual scoped_ptr<MetricsLogUploader> CreateUploader( |
74 const base::Callback<void(int)>& on_upload_complete) = 0; | 85 const base::Callback<void(int)>& on_upload_complete) = 0; |
75 | 86 |
76 // Returns the standard interval between upload attempts. | 87 // Returns the standard interval between upload attempts. |
77 virtual base::TimeDelta GetStandardUploadInterval() = 0; | 88 virtual base::TimeDelta GetStandardUploadInterval() = 0; |
78 | 89 |
79 // Returns the name of a key under HKEY_CURRENT_USER that can be used to store | 90 // Returns the name of a key under HKEY_CURRENT_USER that can be used to store |
80 // backups of metrics data. Unused except on Windows. | 91 // backups of metrics data. Unused except on Windows. |
81 virtual base::string16 GetRegistryBackupKey(); | 92 virtual base::string16 GetRegistryBackupKey(); |
93 | |
94 // Called on plugin loading errors. | |
95 virtual void OnPluginLoadingError(const base::FilePath& plugin_path) {} | |
82 }; | 96 }; |
83 | 97 |
84 } // namespace metrics | 98 } // namespace metrics |
85 | 99 |
86 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 100 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |