| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/android/shell_manager.h" | 5 #include "content/shell/android/shell_manager.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "jni/shell_manager_jni.h" | 10 #include "jni/ShellManager_jni.h" |
| 11 | 11 |
| 12 using base::android::ScopedJavaLocalRef; | 12 using base::android::ScopedJavaLocalRef; |
| 13 | 13 |
| 14 base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > | 14 base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > |
| 15 g_content_shell_manager = LAZY_INSTANCE_INITIALIZER; | 15 g_content_shell_manager = LAZY_INSTANCE_INITIALIZER; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 jobject CreateShellView() { | 19 jobject CreateShellView() { |
| 20 JNIEnv* env = base::android::AttachCurrentThread(); | 20 JNIEnv* env = base::android::AttachCurrentThread(); |
| 21 return Java_ShellManager_createShell( | 21 return Java_ShellManager_createShell( |
| 22 env, g_content_shell_manager.Get().obj()).Release(); | 22 env, g_content_shell_manager.Get().obj()).Release(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Register native methods | 25 // Register native methods |
| 26 bool RegisterShellManager(JNIEnv* env) { | 26 bool RegisterShellManager(JNIEnv* env) { |
| 27 return RegisterNativesImpl(env); | 27 return RegisterNativesImpl(env); |
| 28 } | 28 } |
| 29 | 29 |
| 30 static void Init(JNIEnv* env, jclass clazz, jobject obj) { | 30 static void Init(JNIEnv* env, jclass clazz, jobject obj) { |
| 31 g_content_shell_manager.Get().Reset( | 31 g_content_shell_manager.Get().Reset( |
| 32 base::android::ScopedJavaLocalRef<jobject>(env, obj)); | 32 base::android::ScopedJavaLocalRef<jobject>(env, obj)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace content | 35 } // namespace content |
| OLD | NEW |