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 30 matching lines...) Expand all Loading... |
41 std::string local_log_id; | 41 std::string local_log_id; |
42 }; | 42 }; |
43 | 43 |
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 ~WebRtcLogUploader() override; |
52 | 52 |
53 // net::URLFetcherDelegate implementation. | 53 // net::URLFetcherDelegate implementation. |
54 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 54 void OnURLFetchComplete(const net::URLFetcher* source) override; |
55 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, | 55 void OnURLFetchUploadProgress(const net::URLFetcher* source, |
56 int64 current, int64 total) override; | 56 int64 current, |
| 57 int64 total) override; |
57 | 58 |
58 // Returns true is number of logs limit is not reached yet. Increases log | 59 // Returns true is number of logs limit is not reached yet. Increases log |
59 // count if true is returned. Must be called before UploadLog(). | 60 // count if true is returned. Must be called before UploadLog(). |
60 bool ApplyForStartLogging(); | 61 bool ApplyForStartLogging(); |
61 | 62 |
62 // Notifies that logging has stopped and that the log should not be uploaded. | 63 // 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 | 64 // Decreases log count. May only be called if permission to log has been |
64 // granted by calling ApplyForStartLogging() and getting true in return. | 65 // granted by calling ApplyForStartLogging() and getting true in return. |
65 // After this function has been called, a new permission must be granted. | 66 // After this function has been called, a new permission must be granted. |
66 // Call either this function or LoggingStoppedDoUpload(). | 67 // 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. | 170 // Only accessed on the UI thread. |
170 UploadDoneDataMap upload_done_data_; | 171 UploadDoneDataMap upload_done_data_; |
171 | 172 |
172 // When shutting down, don't create new URLFetchers. | 173 // When shutting down, don't create new URLFetchers. |
173 bool shutting_down_; | 174 bool shutting_down_; |
174 | 175 |
175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); | 176 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); |
176 }; | 177 }; |
177 | 178 |
178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ | 179 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ |
OLD | NEW |