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 MOJO_SERVICES_NATIVE_VIEWPORT_ANDROID_MOJO_VIEWPORT_H_
6 #define MOJO_SERVICES_NATIVE_VIEWPORT_ANDROID_MOJO_VIEWPORT_H_
8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h"
14 #include "mojo/services/native_viewport/native_viewport_android.h"
21 struct MojoViewportInit {
25 scoped_refptr<base::SingleThreadTaskRunner> ui_runner;
26 base::WeakPtr<NativeViewportAndroid> native_viewport;
31 static bool Register(JNIEnv* env);
33 static void CreateForActivity(
34 jobject activity, MojoViewportInit* init);
36 explicit MojoViewport(MojoViewportInit* init);
38 void Destroy(JNIEnv* env, jobject obj);
39 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
40 void SurfaceDestroyed(JNIEnv* env, jobject obj);
41 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height);
46 scoped_refptr<base::SingleThreadTaskRunner> ui_runner_;
47 base::WeakPtr<NativeViewportAndroid> native_viewport_;
49 DISALLOW_COPY_AND_ASSIGN(MojoViewport);
52 } // namespace services
55 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_ANDROID_MOJO_VIEWPORT_H_