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