OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/android/cast_window_manager.h" | 5 #include "chromecast/browser/android/cast_window_manager.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 JNIEnv* env = base::android::AttachCurrentThread(); | 45 JNIEnv* env = base::android::AttachCurrentThread(); |
46 jobject j_window_manager = g_window_manager.Get().obj(); | 46 jobject j_window_manager = g_window_manager.Get().obj(); |
47 Java_CastWindowManager_closeCastWindow(env, j_window_manager, shell_wrapper); | 47 Java_CastWindowManager_closeCastWindow(env, j_window_manager, shell_wrapper); |
48 } | 48 } |
49 | 49 |
50 // Register native methods | 50 // Register native methods |
51 bool RegisterCastWindowManager(JNIEnv* env) { | 51 bool RegisterCastWindowManager(JNIEnv* env) { |
52 return RegisterNativesImpl(env); | 52 return RegisterNativesImpl(env); |
53 } | 53 } |
54 | 54 |
55 void Init(JNIEnv* env, jclass clazz, jobject obj) { | 55 void Init(JNIEnv* env, |
| 56 const JavaParamRef<jclass>& clazz, |
| 57 const JavaParamRef<jobject>& obj) { |
56 g_window_manager.Get().Reset( | 58 g_window_manager.Get().Reset( |
57 base::android::ScopedJavaLocalRef<jobject>(env, obj)); | 59 base::android::ScopedJavaLocalRef<jobject>(env, obj)); |
58 } | 60 } |
59 | 61 |
60 jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) { | 62 jlong LaunchCastWindow(JNIEnv* env, |
| 63 const JavaParamRef<jclass>& clazz, |
| 64 const JavaParamRef<jstring>& jurl) { |
61 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); | 65 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); |
62 return reinterpret_cast<jlong>( | 66 return reinterpret_cast<jlong>( |
63 CastWindowAndroid::CreateNewWindow( | 67 CastWindowAndroid::CreateNewWindow( |
64 CastBrowserProcess::GetInstance()->browser_context(), | 68 CastBrowserProcess::GetInstance()->browser_context(), |
65 url)); | 69 url)); |
66 } | 70 } |
67 | 71 |
68 void StopCastWindow(JNIEnv* env, jclass clazz, | 72 void StopCastWindow(JNIEnv* env, |
69 jlong nativeCastWindow, jboolean gracefully) { | 73 const JavaParamRef<jclass>& clazz, |
| 74 jlong nativeCastWindow, |
| 75 jboolean gracefully) { |
70 CastWindowAndroid* window = | 76 CastWindowAndroid* window = |
71 reinterpret_cast<CastWindowAndroid*>(nativeCastWindow); | 77 reinterpret_cast<CastWindowAndroid*>(nativeCastWindow); |
72 DCHECK(window); | 78 DCHECK(window); |
73 if (gracefully) | 79 if (gracefully) |
74 window->Close(); | 80 window->Close(); |
75 else | 81 else |
76 window->Destroy(); | 82 window->Destroy(); |
77 } | 83 } |
78 | 84 |
79 void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) { | 85 void EnableDevTools(JNIEnv* env, |
| 86 const JavaParamRef<jclass>& clazz, |
| 87 jboolean enable) { |
80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 88 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
81 CastBrowserProcess::GetInstance()->pref_service()->SetBoolean( | 89 CastBrowserProcess::GetInstance()->pref_service()->SetBoolean( |
82 prefs::kEnableRemoteDebugging, enable); | 90 prefs::kEnableRemoteDebugging, enable); |
83 } | 91 } |
84 | 92 |
85 } // namespace shell | 93 } // namespace shell |
86 } // namespace chromecast | 94 } // namespace chromecast |
OLD | NEW |