| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 // Used to implement a trace upload service for use in about://tracing, | 14 // Used to implement a trace upload service for use in about://tracing, |
| 15 // which gets requested through the TracingDelegate. | 15 // which gets requested through the TracingDelegate. |
| 16 class TraceUploader { | 16 class TraceUploader { |
| 17 public: | 17 public: |
| 18 // This should be called when the tracing is complete. | 18 // This should be called when the tracing is complete. |
| 19 // The bool denotes success or failure, the string is feedback | 19 // The bool denotes success or failure, the string is feedback |
| 20 // to show in the Tracing UI. | 20 // to show in the Tracing UI. |
| 21 typedef base::Callback<void(bool, const std::string&)> UploadDoneCallback; | 21 typedef base::Callback<void(bool, const std::string&)> UploadDoneCallback; |
| 22 // Call this to update the progress UI with the current bytes uploaded, | 22 // Call this to update the progress UI with the current bytes uploaded, |
| 23 // as well as the total. | 23 // as well as the total. |
| 24 typedef base::Callback<void(int64, int64)> UploadProgressCallback; | 24 typedef base::Callback<void(int64, int64)> UploadProgressCallback; |
| 25 | 25 |
| 26 virtual ~TraceUploader() {} | 26 virtual ~TraceUploader() {} |
| 27 | 27 |
| 28 enum UploadMode { COMPRESSED_UPLOAD, UNCOMPRESSED_UPLOAD }; |
| 29 |
| 28 // Compresses and uploads the given file contents. | 30 // Compresses and uploads the given file contents. |
| 29 virtual void DoUpload(const std::string& file_contents, | 31 virtual void DoUpload(const std::string& file_contents, |
| 32 UploadMode upload_mode, |
| 30 scoped_ptr<base::DictionaryValue> metadata, | 33 scoped_ptr<base::DictionaryValue> metadata, |
| 31 const UploadProgressCallback& progress_callback, | 34 const UploadProgressCallback& progress_callback, |
| 32 const UploadDoneCallback& done_callback) = 0; | 35 const UploadDoneCallback& done_callback) = 0; |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 } // namespace content | 38 } // namespace content |
| 36 | 39 |
| 37 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ | 40 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ |
| OLD | NEW |