OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 | |
5 #ifndef CONTENT_SHELL_ANDROID_TRACING_SHELL_H | |
6 #define CONTENT_SHELL_ANDROID_TRACING_SHELL_H | |
7 | |
8 #include <jni.h> | |
9 #include <string> | |
10 | |
11 #include "base/file_util.h" | |
12 #include "content/public/browser/trace_subscriber.h" | |
13 | |
14 namespace content { | |
15 | |
16 // Registers the TraceController native methods. | |
17 bool RegisterTracingHandler(JNIEnv* env); | |
Ted C
2012/12/26 16:18:28
this should be RegisterTracingIntentHandler
| |
18 | |
19 class TracingIntentHandler | |
Ted C
2012/12/26 16:18:28
the file name and ifdef should match this class na
| |
20 : public content::TraceSubscriber { | |
Ted C
2012/12/26 16:18:28
I think it would be better to just extend from Tra
| |
21 public: | |
22 TracingIntentHandler(); | |
23 virtual ~TracingIntentHandler() {} | |
24 | |
25 // TraceSubscriber | |
Ted C
2012/12/26 16:18:28
Add "implementation" to the end so it's clearer.
| |
26 virtual void OnEndTracingComplete(); | |
27 virtual void OnTraceDataCollected( | |
28 const scoped_refptr<base::RefCountedString>& trace_fragment); | |
29 | |
30 // IntentHandler | |
31 void OnBeginTracing(std::string path); | |
32 void OnEndTracing(); | |
33 | |
34 bool in_tracing() { return in_tracing_; } | |
35 void SetInTracing(bool tracing) { in_tracing_ = tracing; } | |
Ted C
2012/12/26 16:18:28
if you are inlining functions in the header, it sh
| |
36 | |
37 struct JsonString { | |
Ted C
2012/12/26 16:18:28
This should probably be a class as well since it's
| |
38 void Start(); | |
39 void AddFragment(const std::string&); | |
40 void Finish(); | |
41 | |
42 bool first_; | |
43 std::string data_; | |
44 }; | |
45 | |
46 private: | |
47 bool in_tracing_; | |
48 FilePath path_to_save_; | |
49 JsonString trace_data_to_save_; | |
50 }; | |
51 | |
52 } // namespace content | |
53 #endif // CONTENT_SHELL_ANDROID_TRACING_SHELL_H | |
OLD | NEW |