Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / android / tracing_controller_android.h
blob58e6b94d36bf2e694a2ef7b06c121233e43e8b80
1 // Copyright 2013 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_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_
8 #include <set>
10 #include "base/android/jni_weak_ref.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/weak_ptr.h"
14 namespace content {
16 // This class implements the native methods of TracingControllerAndroid.java
17 class TracingControllerAndroid {
18 public:
19 TracingControllerAndroid(JNIEnv* env, jobject obj);
20 void Destroy(JNIEnv* env, jobject obj);
22 bool StartTracing(JNIEnv* env,
23 jobject obj,
24 jstring categories,
25 jstring trace_options);
26 void StopTracing(JNIEnv* env, jobject obj, jstring jfilepath);
27 bool GetKnownCategoryGroupsAsync(JNIEnv* env, jobject obj);
28 static void GenerateTracingFilePath(base::FilePath* file_path);
30 private:
31 ~TracingControllerAndroid();
32 void OnTracingStopped();
33 void OnKnownCategoriesReceived(
34 const std::set<std::string>& categories_received);
36 JavaObjectWeakGlobalRef weak_java_object_;
37 base::WeakPtrFactory<TracingControllerAndroid> weak_factory_;
39 DISALLOW_COPY_AND_ASSIGN(TracingControllerAndroid);
42 // Register this class's native methods through jni.
43 bool RegisterTracingControllerAndroid(JNIEnv* env);
45 } // namespace content
47 #endif // CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_