summaryrefslogtreecommitdiffstats
path: root/content/browser/android/tracing_controller_android.h
blob: 4d70e7b75ef912a557bebf61af854d23c3fbec6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_
#define CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_

#include "base/android/jni_helper.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"

namespace content {

// This class implements the native methods of TracingControllerAndroid.java
class TracingControllerAndroid {
 public:
  TracingControllerAndroid(JNIEnv* env, jobject obj);
  void Destroy(JNIEnv* env, jobject obj);

  bool StartTracing(JNIEnv* env,
                    jobject obj,
                    jstring filename,
                    jstring categories,
                    jboolean record_continuously);
  void StopTracing(JNIEnv* env, jobject obj);

 private:
  ~TracingControllerAndroid();
  void OnTracingStopped(const base::FilePath& file_path);

  JavaObjectWeakGlobalRef weak_java_object_;
  base::FilePath file_path_;
  base::WeakPtrFactory<TracingControllerAndroid> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(TracingControllerAndroid);
};

// Register this class's native methods through jni.
bool RegisterTracingControllerAndroid(JNIEnv* env);

}  // namespace content

#endif  // CONTENT_BROWSER_ANDROID_TRACING_CONTROLLER_ANDROID_H_