| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have | 44 // WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have |
| 45 // been started and denies further logs if a limit is reached. It also adds | 45 // been started and denies further logs if a limit is reached. It also adds |
| 46 // the timestamp and report ID of the uploded log to a text file. There must | 46 // the timestamp and report ID of the uploded log to a text file. There must |
| 47 // only be one object of this type. | 47 // only be one object of this type. |
| 48 class WebRtcLogUploader : public net::URLFetcherDelegate { | 48 class WebRtcLogUploader : public net::URLFetcherDelegate { |
| 49 public: | 49 public: |
| 50 WebRtcLogUploader(); | 50 WebRtcLogUploader(); |
| 51 virtual ~WebRtcLogUploader(); | 51 virtual ~WebRtcLogUploader(); |
| 52 | 52 |
| 53 // net::URLFetcherDelegate implementation. | 53 // net::URLFetcherDelegate implementation. |
| 54 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 54 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 55 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | 55 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, |
| 56 int64 current, int64 total) OVERRIDE; | 56 int64 current, int64 total) override; |
| 57 | 57 |
| 58 // Returns true is number of logs limit is not reached yet. Increases log | 58 // Returns true is number of logs limit is not reached yet. Increases log |
| 59 // count if true is returned. Must be called before UploadLog(). | 59 // count if true is returned. Must be called before UploadLog(). |
| 60 bool ApplyForStartLogging(); | 60 bool ApplyForStartLogging(); |
| 61 | 61 |
| 62 // Notifies that logging has stopped and that the log should not be uploaded. | 62 // Notifies that logging has stopped and that the log should not be uploaded. |
| 63 // Decreases log count. May only be called if permission to log has been | 63 // Decreases log count. May only be called if permission to log has been |
| 64 // granted by calling ApplyForStartLogging() and getting true in return. | 64 // granted by calling ApplyForStartLogging() and getting true in return. |
| 65 // After this function has been called, a new permission must be granted. | 65 // After this function has been called, a new permission must be granted. |
| 66 // Call either this function or LoggingStoppedDoUpload(). | 66 // Call either this function or LoggingStoppedDoUpload(). |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Only accessed on the UI thread. | 169 // Only accessed on the UI thread. |
| 170 UploadDoneDataMap upload_done_data_; | 170 UploadDoneDataMap upload_done_data_; |
| 171 | 171 |
| 172 // When shutting down, don't create new URLFetchers. | 172 // When shutting down, don't create new URLFetchers. |
| 173 bool shutting_down_; | 173 bool shutting_down_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); | 175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
| OLD | NEW |