OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
Jói
2013/05/08 14:14:22
nit: I think we no longer include the (c)
Henrik Grunell
2013/05/08 16:05:05
Done.
| |
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_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ | |
6 #define COMPONENTS_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/platform_file.h" | |
14 #include "components/webrtc_log_uploader/webrtc_log_uploader_export.h" | |
15 #include "net/url_request/url_fetcher_delegate.h" | |
16 | |
17 namespace base { | |
18 class SharedMemory; | |
19 } | |
20 | |
21 namespace net { | |
22 class URLFetcher; | |
23 } | |
24 | |
25 namespace components { | |
26 | |
27 class WebRtcLogURLRequestContextGetter; | |
28 | |
29 // WebRtcLogUploader uploads WebRTC logs. | |
30 class WEBRTC_LOG_UPLOADER_EXPORT WebRtcLogUploader | |
Jói
2013/05/08 14:14:22
Since this class is decoding a binary buffer creat
Henrik Grunell
2013/05/08 16:05:05
Yes. We have a launch bug for this so it should be
| |
31 : public net::URLFetcherDelegate { | |
32 public: | |
33 WebRtcLogUploader(); | |
34 virtual ~WebRtcLogUploader(); | |
35 | |
36 // net::URLFetcherDelegate implementation. | |
37 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | |
38 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | |
39 int64 current, int64 total) OVERRIDE; | |
40 | |
41 // We take ownership of |shared_memory|. | |
42 // TODO(grunell): Take a scoped_refptr instead. | |
Jói
2013/05/08 14:14:22
Are you planning to fix this before committing, or
Henrik Grunell
2013/05/08 16:05:05
Before committing. Done already.
| |
43 void UploadLog(base::SharedMemory* shared_memory, uint32 length); | |
44 | |
45 private: | |
46 void SetupMultipartFile(uint8* log_buffer, uint32 log_buffer_length); | |
47 void AddPairString(const std::string& key, const std::string& value); | |
48 void AddUrlChunks(); | |
49 void AddLogData(uint8* log_buffer, uint32 log_buffer_length); | |
50 void CompressLog(uint8* input, uint32 input_size, | |
51 base::PlatformFile output_file); | |
52 void AddMultipartValueForUpload(const std::string& value_name, | |
53 const std::string& value, | |
54 const std::string& mime_boundary, | |
55 const std::string& content_type, | |
56 std::string* post_data); | |
57 | |
58 std::vector<net::URLFetcher*> url_fetchers_; | |
59 scoped_refptr<WebRtcLogURLRequestContextGetter> | |
60 request_context_getter_; | |
61 | |
62 base::PlatformFile multipart_file_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); | |
65 }; | |
66 | |
67 } // namespace components | |
68 | |
69 #endif // COMPONENTS_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ | |
OLD | NEW |