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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" |
11 #include "components/metrics/proto/system_profile.pb.h" | 12 #include "components/metrics/proto/system_profile.pb.h" |
12 | 13 |
13 namespace metrics { | 14 namespace metrics { |
14 | 15 |
15 // An abstraction of operations that depend on the embedder's (e.g. Chrome) | 16 // An abstraction of operations that depend on the embedder's (e.g. Chrome) |
16 // environment. | 17 // environment. |
17 class MetricsServiceClient { | 18 class MetricsServiceClient { |
18 public: | 19 public: |
19 virtual ~MetricsServiceClient() {} | 20 virtual ~MetricsServiceClient() {} |
20 | 21 |
21 // Register the client id with other services (e.g. crash reporting), called | 22 // Register the client id with other services (e.g. crash reporting), called |
22 // when metrics recording gets enabled. | 23 // when metrics recording gets enabled. |
23 virtual void SetClientID(const std::string& client_id) = 0; | 24 virtual void SetClientID(const std::string& client_id) = 0; |
24 | 25 |
25 // Whether there's an "off the record" (aka "Incognito") session active. | 26 // Whether there's an "off the record" (aka "Incognito") session active. |
26 virtual bool IsOffTheRecordSessionActive() = 0; | 27 virtual bool IsOffTheRecordSessionActive() = 0; |
27 | 28 |
28 // Returns the current application locale (e.g. "en-US"). | 29 // Returns the current application locale (e.g. "en-US"). |
29 virtual std::string GetApplicationLocale() = 0; | 30 virtual std::string GetApplicationLocale() = 0; |
30 | 31 |
31 // Retrieves the brand code string associated with the install, returning | 32 // Retrieves the brand code string associated with the install, returning |
32 // false if no brand code is available. | 33 // false if no brand code is available. |
33 virtual bool GetBrand(std::string* brand_code) = 0; | 34 virtual bool GetBrand(std::string* brand_code) = 0; |
34 | 35 |
35 // Returns the release channel (e.g. stable, beta, etc) of the application. | 36 // Returns the release channel (e.g. stable, beta, etc) of the application. |
36 virtual SystemProfileProto::Channel GetChannel() = 0; | 37 virtual SystemProfileProto::Channel GetChannel() = 0; |
37 | 38 |
38 // Returns the version of the application as a string. | 39 // Returns the version of the application as a string. |
39 virtual std::string GetVersionString() = 0; | 40 virtual std::string GetVersionString() = 0; |
| 41 |
| 42 // Called prior to a metrics log being closed, allowing the client to collect |
| 43 // extra histograms that will go in that log. Asynchronous API - the client |
| 44 // implementation should call |done_callback| when complete. |
| 45 virtual void OnFinalLogCollection(const base::Closure& done_callback) = 0; |
40 }; | 46 }; |
41 | 47 |
42 } // namespace metrics | 48 } // namespace metrics |
43 | 49 |
44 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 50 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |