OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_ |
| 6 #define CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/shared_memory.h" |
| 10 #include "net/url_request/url_fetcher_delegate.h" |
| 11 #include "net/url_request/url_request_context.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 13 |
| 14 namespace net { |
| 15 class FileStream; |
| 16 class URLFetcher; |
| 17 } |
| 18 |
| 19 class WebRtcLogURLRequestContextGetter; |
| 20 |
| 21 // WebRtcLogUploadManager handles uploading WebRTC logs. It's owned by |
| 22 // BrowserProcessImpl. WebRtcLoggingHandlerHost calls it when a log should be |
| 23 // uploaded and given a shared memory buffer with the log data to be uploaded. |
| 24 class WebRtcLogUploadManager : public net::URLFetcherDelegate { |
| 25 public: |
| 26 WebRtcLogUploadManager(); |
| 27 virtual ~WebRtcLogUploadManager(); |
| 28 |
| 29 // net::URLFetcherDelegate implementation. |
| 30 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 31 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
| 32 int64 current, int64 total) OVERRIDE; |
| 33 |
| 34 // Takes ownership of |shared_memory|. |
| 35 void UploadLog(base::SharedMemory* shared_memory, uint32 length); |
| 36 |
| 37 private: |
| 38 void ReadAndCompressLog(uint8* input, uint32 input_size, |
| 39 uint8* output, uint32* output_size); |
| 40 void SetupUpload(uint8* output, uint32 output_size); |
| 41 void AddPairString(const std::string& key, const std::string& value); |
| 42 void AddUrlChunks(); |
| 43 void AddLogData(uint8* log_data, uint32 log_data_size); |
| 44 |
| 45 std::vector<net::URLFetcher*> url_fetchers_; |
| 46 scoped_refptr<WebRtcLogURLRequestContextGetter> |
| 47 request_context_getter_; |
| 48 |
| 49 scoped_ptr<net::FileStream> file_stream_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploadManager); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_ |
OLD | NEW |