Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: components/metrics/net/net_metrics_log_uploader.h

Issue 291153013: Make MetricsService upload logs through an interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Casts for win64 compile Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "components/metrics/metrics_log_uploader.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13
14 namespace net {
15 class URLFetcher;
16 class URLRequestContextGetter;
17 }
18
19 namespace metrics {
20
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 virtual ~NetMetricsLogUploader();
34
35 // MetricsLogUploader:
36 virtual bool UploadLog(const std::string& log_data,
37 const std::string& log_hash) OVERRIDE;
38
39 private:
40 // net::URLFetcherDelegate:
41 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
42
43 // The request context for fetches done using the network stack.
44 net::URLRequestContextGetter* const request_context_getter_;
45
46 // The outstanding transmission appears as a URL Fetch operation.
47 scoped_ptr<net::URLFetcher> current_fetch_;
48
49 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader);
50 };
51
52 } // namespace metrics
53
54 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « components/metrics/net/compression_utils_unittest.cc ('k') | components/metrics/net/net_metrics_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698