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 | |
22 namespace metrics { | 18 namespace metrics { |
23 | 19 |
24 class MetricsLogUploader; | 20 class MetricsLogUploader; |
25 class MetricsService; | |
26 | 21 |
27 // An abstraction of operations that depend on the embedder's (e.g. Chrome) | 22 // An abstraction of operations that depend on the embedder's (e.g. Chrome) |
28 // environment. | 23 // environment. |
29 class MetricsServiceClient { | 24 class MetricsServiceClient { |
30 public: | 25 public: |
31 virtual ~MetricsServiceClient() {} | 26 virtual ~MetricsServiceClient() {} |
32 | 27 |
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 MetricsService* GetMetricsService() = 0; | |
38 | |
39 // Registers the client id with other services (e.g. crash reporting), called | 28 // Registers the client id with other services (e.g. crash reporting), called |
40 // when metrics recording gets enabled. | 29 // when metrics recording gets enabled. |
41 virtual void SetMetricsClientId(const std::string& client_id) = 0; | 30 virtual void SetMetricsClientId(const std::string& client_id) = 0; |
42 | 31 |
43 // Notifies the client that recording is disabled, so that other services | 32 // Notifies the client that recording is disabled, so that other services |
44 // (such as crash reporting) can clear any association with metrics. | 33 // (such as crash reporting) can clear any association with metrics. |
45 virtual void OnRecordingDisabled() = 0; | 34 virtual void OnRecordingDisabled() = 0; |
46 | 35 |
47 // Whether there's an "off the record" (aka "Incognito") session active. | 36 // Whether there's an "off the record" (aka "Incognito") session active. |
48 virtual bool IsOffTheRecordSessionActive() = 0; | 37 virtual bool IsOffTheRecordSessionActive() = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // MetricsLogUploader for details). | 72 // MetricsLogUploader for details). |
84 virtual scoped_ptr<MetricsLogUploader> CreateUploader( | 73 virtual scoped_ptr<MetricsLogUploader> CreateUploader( |
85 const base::Callback<void(int)>& on_upload_complete) = 0; | 74 const base::Callback<void(int)>& on_upload_complete) = 0; |
86 | 75 |
87 // Returns the standard interval between upload attempts. | 76 // Returns the standard interval between upload attempts. |
88 virtual base::TimeDelta GetStandardUploadInterval() = 0; | 77 virtual base::TimeDelta GetStandardUploadInterval() = 0; |
89 | 78 |
90 // Returns the name of a key under HKEY_CURRENT_USER that can be used to store | 79 // Returns the name of a key under HKEY_CURRENT_USER that can be used to store |
91 // backups of metrics data. Unused except on Windows. | 80 // backups of metrics data. Unused except on Windows. |
92 virtual base::string16 GetRegistryBackupKey(); | 81 virtual base::string16 GetRegistryBackupKey(); |
93 | |
94 // Called on plugin loading errors. | |
95 virtual void OnPluginLoadingError(const base::FilePath& plugin_path) {} | |
96 }; | 82 }; |
97 | 83 |
98 } // namespace metrics | 84 } // namespace metrics |
99 | 85 |
100 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 86 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |