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" |
| 10 #include "base/values.h" |
9 | 11 |
10 namespace content { | 12 namespace content { |
11 | 13 |
12 // 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, |
13 // which gets requested through the TracingDelegate. | 15 // which gets requested through the TracingDelegate. |
14 class TraceUploader { | 16 class TraceUploader { |
15 public: | 17 public: |
16 // This should be called when the tracing is complete. | 18 // This should be called when the tracing is complete. |
17 // The bool denotes success or failure, the string is feedback | 19 // The bool denotes success or failure, the string is feedback |
18 // to show in the Tracing UI. | 20 // to show in the Tracing UI. |
19 typedef base::Callback<void(bool, const std::string&)> UploadDoneCallback; | 21 typedef base::Callback<void(bool, const std::string&)> UploadDoneCallback; |
20 // 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, |
21 // as well as the total. | 23 // as well as the total. |
22 typedef base::Callback<void(int64, int64)> UploadProgressCallback; | 24 typedef base::Callback<void(int64, int64)> UploadProgressCallback; |
23 | 25 |
24 virtual ~TraceUploader() {} | 26 virtual ~TraceUploader() {} |
25 | 27 |
26 // Compresses and uploads the given file contents. | 28 // Compresses and uploads the given file contents. |
27 virtual void DoUpload(const std::string& file_contents, | 29 virtual void DoUpload(const std::string& file_contents, |
| 30 scoped_ptr<base::DictionaryValue> metadata, |
28 const UploadProgressCallback& progress_callback, | 31 const UploadProgressCallback& progress_callback, |
29 const UploadDoneCallback& done_callback) = 0; | 32 const UploadDoneCallback& done_callback) = 0; |
30 }; | 33 }; |
31 | 34 |
32 } // namespace content | 35 } // namespace content |
33 | 36 |
34 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ | 37 #endif // CONTENT_PUBLIC_BROWSER_TRACE_UPLOADER_H_ |
OLD | NEW |