[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 1 | // 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 | |||||
tfarina | bccc34c7 | 2015-02-27 21:32:15 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_TRACING_TRACING_UI_H_ |
6 | #define CONTENT_BROWSER_TRACING_TRACING_UI_H_ | ||||
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stdint.h> |
9 | |||||
[email protected] | b12387e6 | 2014-06-27 20:52:06 | [diff] [blame] | 10 | #include <map> |
11 | #include <string> | ||||
12 | |||||
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 13 | #include "base/macros.h" |
[email protected] | b12387e6 | 2014-06-27 20:52:06 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
simonhatch | c93f6b8 | 2015-07-08 16:09:06 | [diff] [blame] | 15 | #include "content/public/browser/trace_uploader.h" |
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 16 | #include "content/public/browser/web_ui_controller.h" |
17 | |||||
erikchen | 3e164f7 | 2017-06-22 21:15:44 | [diff] [blame] | 18 | namespace base { |
19 | namespace trace_event { | ||||
20 | class TraceConfig; | ||||
21 | } // namespace trace_event | ||||
22 | } // namespace base | ||||
23 | |||||
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 24 | namespace content { |
25 | |||||
oysteine | c563c58 | 2015-02-13 19:19:52 | [diff] [blame] | 26 | class TracingDelegate; |
27 | |||||
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 28 | // The C++ back-end for the chrome://tracing webui page. |
[email protected] | 06d5b6e | 2014-01-14 14:55:58 | [diff] [blame] | 29 | class CONTENT_EXPORT TracingUI : public WebUIController { |
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 30 | public: |
31 | explicit TracingUI(WebUI* web_ui); | ||||
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 32 | ~TracingUI() override; |
erikchen | 3e164f7 | 2017-06-22 21:15:44 | [diff] [blame] | 33 | |
34 | // Public for testing. | ||||
35 | static bool GetTracingOptions(const std::string& data64, | ||||
36 | base::trace_event::TraceConfig* trace_config); | ||||
37 | |||||
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 38 | void OnTraceUploadProgress(int64_t current, int64_t total); |
oysteine | c563c58 | 2015-02-13 19:19:52 | [diff] [blame] | 39 | void OnTraceUploadComplete(bool success, const std::string& feedback); |
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 40 | |
41 | private: | ||||
simonhatch | c93f6b8 | 2015-07-08 16:09:06 | [diff] [blame] | 42 | void DoUploadInternal(const std::string& file_contents, |
43 | TraceUploader::UploadMode upload_mode); | ||||
simonhatch | a13b0a5 | 2015-06-23 20:23:08 | [diff] [blame] | 44 | void DoUpload(const base::ListValue* args); |
45 | void DoUploadBase64Encoded(const base::ListValue* args); | ||||
46 | |||||
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 47 | std::unique_ptr<TracingDelegate> delegate_; |
48 | std::unique_ptr<TraceUploader> trace_uploader_; | ||||
[email protected] | b12387e6 | 2014-06-27 20:52:06 | [diff] [blame] | 49 | base::WeakPtrFactory<TracingUI> weak_factory_; |
50 | |||||
[email protected] | bcb6ee23d | 2013-02-03 04:06:40 | [diff] [blame] | 51 | DISALLOW_COPY_AND_ASSIGN(TracingUI); |
52 | }; | ||||
53 | |||||
54 | } // namespace content | ||||
55 | |||||
tfarina | bccc34c7 | 2015-02-27 21:32:15 | [diff] [blame] | 56 | #endif // CONTENT_BROWSER_TRACING_TRACING_UI_H_ |