blob: 0565a02c04ce0545f0ac42dc62c2db46c4baa8f6 [file] [log] [blame]
[email protected]bcb6ee23d2013-02-03 04:06:401// Copyright (c) 2011 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.
4
tfarinabccc34c72015-02-27 21:32:155#ifndef CONTENT_BROWSER_TRACING_TRACING_UI_H_
6#define CONTENT_BROWSER_TRACING_TRACING_UI_H_
[email protected]bcb6ee23d2013-02-03 04:06:407
avib7348942015-12-25 20:57:108#include <stdint.h>
9
[email protected]b12387e62014-06-27 20:52:0610#include <map>
11#include <string>
12
avib7348942015-12-25 20:57:1013#include "base/macros.h"
[email protected]b12387e62014-06-27 20:52:0614#include "base/memory/weak_ptr.h"
simonhatchc93f6b82015-07-08 16:09:0615#include "content/public/browser/trace_uploader.h"
[email protected]bcb6ee23d2013-02-03 04:06:4016#include "content/public/browser/web_ui_controller.h"
17
erikchen3e164f72017-06-22 21:15:4418namespace base {
19namespace trace_event {
20class TraceConfig;
21} // namespace trace_event
22} // namespace base
23
[email protected]bcb6ee23d2013-02-03 04:06:4024namespace content {
25
oysteinec563c582015-02-13 19:19:5226class TracingDelegate;
27
[email protected]bcb6ee23d2013-02-03 04:06:4028// The C++ back-end for the chrome://tracing webui page.
[email protected]06d5b6e2014-01-14 14:55:5829class CONTENT_EXPORT TracingUI : public WebUIController {
[email protected]bcb6ee23d2013-02-03 04:06:4030 public:
31 explicit TracingUI(WebUI* web_ui);
dchengc2282aa2014-10-21 12:07:5832 ~TracingUI() override;
erikchen3e164f72017-06-22 21:15:4433
34 // Public for testing.
35 static bool GetTracingOptions(const std::string& data64,
36 base::trace_event::TraceConfig* trace_config);
37
avib7348942015-12-25 20:57:1038 void OnTraceUploadProgress(int64_t current, int64_t total);
oysteinec563c582015-02-13 19:19:5239 void OnTraceUploadComplete(bool success, const std::string& feedback);
[email protected]bcb6ee23d2013-02-03 04:06:4040
41 private:
simonhatchc93f6b82015-07-08 16:09:0642 void DoUploadInternal(const std::string& file_contents,
43 TraceUploader::UploadMode upload_mode);
simonhatcha13b0a52015-06-23 20:23:0844 void DoUpload(const base::ListValue* args);
45 void DoUploadBase64Encoded(const base::ListValue* args);
46
dcheng59716272016-04-09 05:19:0847 std::unique_ptr<TracingDelegate> delegate_;
48 std::unique_ptr<TraceUploader> trace_uploader_;
[email protected]b12387e62014-06-27 20:52:0649 base::WeakPtrFactory<TracingUI> weak_factory_;
50
[email protected]bcb6ee23d2013-02-03 04:06:4051 DISALLOW_COPY_AND_ASSIGN(TracingUI);
52};
53
54} // namespace content
55
tfarinabccc34c72015-02-27 21:32:1556#endif // CONTENT_BROWSER_TRACING_TRACING_UI_H_