OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/shell/android/shell_manager.h" |
| 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/lazy_instance.h" |
| 10 #include "content/shell/android/shell_view.h" |
| 11 #include "jni/shell_manager_jni.h" |
| 12 |
| 13 using base::android::ScopedJavaLocalRef; |
| 14 |
| 15 base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > |
| 16 g_content_shell_manager = LAZY_INSTANCE_INITIALIZER; |
| 17 |
| 18 namespace content { |
| 19 |
| 20 ShellView* CreateShellView() { |
| 21 JNIEnv* env = base::android::AttachCurrentThread(); |
| 22 return reinterpret_cast<ShellView*>(Java_ShellManager_createShell( |
| 23 env, g_content_shell_manager.Get().obj())); |
| 24 } |
| 25 |
| 26 // Register native methods |
| 27 bool RegisterShellManager(JNIEnv* env) { |
| 28 return RegisterNativesImpl(env); |
| 29 } |
| 30 |
| 31 } // namespace content |
| 32 |
| 33 // ---------------------------------------------------------------------------- |
| 34 // Native JNI methods |
| 35 // ---------------------------------------------------------------------------- |
| 36 |
| 37 void Init(JNIEnv* env, jclass clazz, jobject obj) { |
| 38 g_content_shell_manager.Get().Reset( |
| 39 base::android::ScopedJavaLocalRef<jobject>(env, obj)); |
| 40 } |
OLD | NEW |