Revert of ui: Clean up damaged rects and clear them after painting. (patchset #2...
[chromium-blink-merge.git] / components / metrics / net / net_metrics_log_uploader.h
blob278a6197d244d8d12995d296175028a3b7ce489c
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "components/metrics/metrics_log_uploader.h"
12 #include "net/url_request/url_fetcher_delegate.h"
14 namespace net {
15 class URLFetcher;
16 class URLRequestContextGetter;
19 namespace metrics {
21 // Implementation of MetricsLogUploader using the Chrome network stack.
22 class NetMetricsLogUploader : public MetricsLogUploader,
23 public net::URLFetcherDelegate {
24 public:
25 // Constructs a NetMetricsLogUploader with the specified request context and
26 // other params (see comments on MetricsLogUploader for details). The caller
27 // must ensure that |request_context_getter| remains valid for the lifetime
28 // of this class.
29 NetMetricsLogUploader(net::URLRequestContextGetter* request_context_getter,
30 const std::string& server_url,
31 const std::string& mime_type,
32 const base::Callback<void(int)>& on_upload_complete);
33 ~NetMetricsLogUploader() override;
35 // MetricsLogUploader:
36 bool UploadLog(const std::string& compressed_log_data,
37 const std::string& log_hash) override;
39 private:
40 // net::URLFetcherDelegate:
41 void OnURLFetchComplete(const net::URLFetcher* source) override;
43 // The request context for fetches done using the network stack.
44 net::URLRequestContextGetter* const request_context_getter_;
46 // The outstanding transmission appears as a URL Fetch operation.
47 scoped_ptr<net::URLFetcher> current_fetch_;
49 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader);
52 } // namespace metrics
54 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_