Chromium Code Reviews| Index: ui/android/view_android.h |
| diff --git a/ui/android/view_android.h b/ui/android/view_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0631b57a54bd2a4c38f4d75425e5a02a5f6ed419 |
| --- /dev/null |
| +++ b/ui/android/view_android.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
nilesh
2013/04/12 19:07:10
2013
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEW_ANDROID_H_ |
|
nilesh
2013/04/12 19:07:10
UI_ANDROID_VIEW_ANDROID_H
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
| +#define UI_VIEW_ANDROID_H_ |
| + |
| +#include <jni.h> |
| +#include "base/android/jni_helper.h" |
| +#include "base/android/scoped_java_ref.h" |
| + |
| +namespace ui { |
| + |
| +class WindowAndroid; |
| + |
| +// This class deals with the Android native window ref count. |
|
joth
2013/04/12 19:00:48
i"m not sure what ref count that is?
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
| +class ViewAndroid { |
|
joth
2013/04/12 19:00:48
Can we get the java and native class names consist
aurimas (slooooooooow)
2013/04/12 22:00:41
Done.
|
| + public: |
| + ViewAndroid(JNIEnv* env, jobject obj, WindowAndroid* window); |
|
joth
2013/04/12 19:00:48
what's the lifetime relationship of |window| ? it
aurimas (slooooooooow)
2013/04/12 22:00:41
WindowAndroid has a life time of the application.
joth
2013/04/16 04:02:42
I see.
nit: I think you mean activity, not applic
|
| + |
| + void Destroy(JNIEnv* env, jobject obj); |
| + |
| + WindowAndroid* GetWindowAndroid(); |
| + |
| + base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
|
joth
2013/04/12 19:00:48
note - will return NULL if the java side was GCed
aurimas (slooooooooow)
2013/04/12 22:00:41
How can I fix this? Add null checks?
joth
2013/04/16 04:02:42
yeah.. we basically get this pattern that any time
|
| + |
| + static bool RegisterViewAndroid(JNIEnv* env); |
| + |
| + private: |
| + ~ViewAndroid(); |
| + JavaObjectWeakGlobalRef weak_java_view_; |
| + WindowAndroid* window_android_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ViewAndroid); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_VIEW_ANDROID_H_ |