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_NET_NET_METRICS_LOG_UPLOADER_H_ | 5 #ifndef COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ |
6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ | 6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 class NetMetricsLogUploader : public MetricsLogUploader, | 23 class NetMetricsLogUploader : public MetricsLogUploader, |
24 public net::URLFetcherDelegate { | 24 public net::URLFetcherDelegate { |
25 public: | 25 public: |
26 // Constructs a NetMetricsLogUploader with the specified request context and | 26 // Constructs a NetMetricsLogUploader with the specified request context and |
27 // other params (see comments on MetricsLogUploader for details). The caller | 27 // other params (see comments on MetricsLogUploader for details). The caller |
28 // must ensure that |request_context_getter| remains valid for the lifetime | 28 // must ensure that |request_context_getter| remains valid for the lifetime |
29 // of this class. | 29 // of this class. |
30 NetMetricsLogUploader(net::URLRequestContextGetter* request_context_getter, | 30 NetMetricsLogUploader(net::URLRequestContextGetter* request_context_getter, |
31 const std::string& server_url, | 31 const std::string& server_url, |
32 const std::string& mime_type, | 32 const std::string& mime_type, |
| 33 MetricsLogUploader::MetricServiceType service_type, |
33 const base::Callback<void(int)>& on_upload_complete); | 34 const base::Callback<void(int)>& on_upload_complete); |
34 ~NetMetricsLogUploader() override; | 35 ~NetMetricsLogUploader() override; |
35 | 36 |
36 // MetricsLogUploader: | 37 // MetricsLogUploader: |
37 void UploadLog(const std::string& compressed_log_data, | 38 void UploadLog(const std::string& compressed_log_data, |
38 const std::string& log_hash) override; | 39 const std::string& log_hash) override; |
39 | 40 |
40 private: | 41 private: |
41 // net::URLFetcherDelegate: | 42 // net::URLFetcherDelegate: |
42 void OnURLFetchComplete(const net::URLFetcher* source) override; | 43 void OnURLFetchComplete(const net::URLFetcher* source) override; |
43 | 44 |
44 // The request context for fetches done using the network stack. | 45 // The request context for fetches done using the network stack. |
45 net::URLRequestContextGetter* const request_context_getter_; | 46 net::URLRequestContextGetter* const request_context_getter_; |
46 | 47 |
47 // The outstanding transmission appears as a URL Fetch operation. | 48 // The outstanding transmission appears as a URL Fetch operation. |
48 std::unique_ptr<net::URLFetcher> current_fetch_; | 49 std::unique_ptr<net::URLFetcher> current_fetch_; |
49 | 50 |
50 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader); | 51 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace metrics | 54 } // namespace metrics |
54 | 55 |
55 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ | 56 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ |
OLD | NEW |