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 "base/callback_forward.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "components/metrics/proto/system_profile.pb.h" | 13 #include "components/metrics/proto/system_profile.pb.h" |
13 | 14 |
14 namespace metrics { | 15 namespace metrics { |
15 | 16 |
| 17 class MetricsLogUploader; |
| 18 |
16 // An abstraction of operations that depend on the embedder's (e.g. Chrome) | 19 // An abstraction of operations that depend on the embedder's (e.g. Chrome) |
17 // environment. | 20 // environment. |
18 class MetricsServiceClient { | 21 class MetricsServiceClient { |
19 public: | 22 public: |
20 virtual ~MetricsServiceClient() {} | 23 virtual ~MetricsServiceClient() {} |
21 | 24 |
22 // Register the client id with other services (e.g. crash reporting), called | 25 // Register the client id with other services (e.g. crash reporting), called |
23 // when metrics recording gets enabled. | 26 // when metrics recording gets enabled. |
24 virtual void SetClientID(const std::string& client_id) = 0; | 27 virtual void SetClientID(const std::string& client_id) = 0; |
25 | 28 |
(...skipping 17 matching lines...) Expand all Loading... |
43 virtual void OnLogUploadComplete() = 0; | 46 virtual void OnLogUploadComplete() = 0; |
44 | 47 |
45 // Starts gathering metrics, calling |done_callback| when initial metrics | 48 // Starts gathering metrics, calling |done_callback| when initial metrics |
46 // gathering is complete. | 49 // gathering is complete. |
47 virtual void StartGatheringMetrics(const base::Closure& done_callback) = 0; | 50 virtual void StartGatheringMetrics(const base::Closure& done_callback) = 0; |
48 | 51 |
49 // Called prior to a metrics log being closed, allowing the client to collect | 52 // Called prior to a metrics log being closed, allowing the client to collect |
50 // extra histograms that will go in that log. Asynchronous API - the client | 53 // extra histograms that will go in that log. Asynchronous API - the client |
51 // implementation should call |done_callback| when complete. | 54 // implementation should call |done_callback| when complete. |
52 virtual void CollectFinalMetrics(const base::Closure& done_callback) = 0; | 55 virtual void CollectFinalMetrics(const base::Closure& done_callback) = 0; |
| 56 |
| 57 // Creates a MetricsLogUploader with the specified parameters (see comments on |
| 58 // MetricsLogUploader for details). |
| 59 virtual scoped_ptr<MetricsLogUploader> CreateUploader( |
| 60 const std::string& server_url, |
| 61 const std::string& mime_type, |
| 62 const base::Callback<void(int)>& on_upload_complete) = 0; |
53 }; | 63 }; |
54 | 64 |
55 } // namespace metrics | 65 } // namespace metrics |
56 | 66 |
57 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ | 67 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_ |
OLD | NEW |