Index: components/webrtc_log_uploader/webrtc_log_uploader.h |
diff --git a/components/webrtc_log_uploader/webrtc_log_uploader.h b/components/webrtc_log_uploader/webrtc_log_uploader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2292a784e0c58c5cec119b7dd97935302acb1a46 |
--- /dev/null |
+++ b/components/webrtc_log_uploader/webrtc_log_uploader.h |
@@ -0,0 +1,69 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ |
+#define COMPONENTS_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/platform_file.h" |
+#include "components/webrtc_log_uploader/webrtc_log_uploader_export.h" |
+#include "net/url_request/url_fetcher_delegate.h" |
+ |
+namespace base { |
+class SharedMemory; |
+} |
+ |
+namespace net { |
+class URLFetcher; |
+} |
+ |
+namespace components { |
+ |
+class WebRtcLogURLRequestContextGetter; |
+ |
+// WebRtcLogUploader uploads WebRTC logs. |
+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
|
+ : public net::URLFetcherDelegate { |
+ public: |
+ WebRtcLogUploader(); |
+ virtual ~WebRtcLogUploader(); |
+ |
+ // net::URLFetcherDelegate implementation. |
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
+ virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
+ int64 current, int64 total) OVERRIDE; |
+ |
+ // We take ownership of |shared_memory|. |
+ // 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.
|
+ void UploadLog(base::SharedMemory* shared_memory, uint32 length); |
+ |
+ private: |
+ void SetupMultipartFile(uint8* log_buffer, uint32 log_buffer_length); |
+ void AddPairString(const std::string& key, const std::string& value); |
+ void AddUrlChunks(); |
+ void AddLogData(uint8* log_buffer, uint32 log_buffer_length); |
+ void CompressLog(uint8* input, uint32 input_size, |
+ base::PlatformFile output_file); |
+ void AddMultipartValueForUpload(const std::string& value_name, |
+ const std::string& value, |
+ const std::string& mime_boundary, |
+ const std::string& content_type, |
+ std::string* post_data); |
+ |
+ std::vector<net::URLFetcher*> url_fetchers_; |
+ scoped_refptr<WebRtcLogURLRequestContextGetter> |
+ request_context_getter_; |
+ |
+ base::PlatformFile multipart_file_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); |
+}; |
+ |
+} // namespace components |
+ |
+#endif // COMPONENTS_WEBRTC_LOG_UPLOADER_WEBRTC_LOG_UPLOADER_H_ |