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 // Compresses and uploads the given file contents. | 28 // Compresses and uploads the given file contents. |
29 virtual void DoUpload(const std::string& file_contents, | 29 virtual void DoUpload(const std::string& file_contents, |
30 bool compress_on_upload, | |
dsinclair
2015/07/07 16:42:04
Can we switch the bool to an enum? COMPRESSED_UPLO
shatch
2015/07/07 18:25:48
Done.
| |
30 scoped_ptr<base::DictionaryValue> metadata, | 31 scoped_ptr<base::DictionaryValue> metadata, |
31 const UploadProgressCallback& progress_callback, | 32 const UploadProgressCallback& progress_callback, |
32 const UploadDoneCallback& done_callback) = 0; | 33 const UploadDoneCallback& done_callback) = 0; |
33 }; | 34 }; |
34 | 35 |
35 } // namespace content | 36 } // namespace content |
36 | 37 |
37 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ | 38 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ |
OLD | NEW |