OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/browser/shell.h" | 5 #include "content/shell/browser/shell.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 void Shell::PlatformCleanUp() { | 31 void Shell::PlatformCleanUp() { |
32 JNIEnv* env = AttachCurrentThread(); | 32 JNIEnv* env = AttachCurrentThread(); |
33 if (java_object_.is_null()) | 33 if (java_object_.is_null()) |
34 return; | 34 return; |
35 Java_Shell_onNativeDestroyed(env, java_object_.obj()); | 35 Java_Shell_onNativeDestroyed(env, java_object_.obj()); |
36 } | 36 } |
37 | 37 |
38 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { | 38 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { |
| 39 JNIEnv* env = AttachCurrentThread(); |
| 40 if (java_object_.is_null()) |
| 41 return; |
| 42 Java_Shell_enableUiControl(env, java_object_.obj(), control, is_enabled); |
39 } | 43 } |
40 | 44 |
41 void Shell::PlatformSetAddressBarURL(const GURL& url) { | 45 void Shell::PlatformSetAddressBarURL(const GURL& url) { |
42 JNIEnv* env = AttachCurrentThread(); | 46 JNIEnv* env = AttachCurrentThread(); |
43 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); | 47 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
44 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj()); | 48 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj()); |
45 } | 49 } |
46 | 50 |
47 void Shell::PlatformSetIsLoading(bool loading) { | 51 void Shell::PlatformSetIsLoading(bool loading) { |
48 JNIEnv* env = AttachCurrentThread(); | 52 JNIEnv* env = AttachCurrentThread(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return RegisterNativesImpl(env); | 104 return RegisterNativesImpl(env); |
101 } | 105 } |
102 | 106 |
103 // static | 107 // static |
104 void CloseShell(JNIEnv* env, jclass clazz, jlong shellPtr) { | 108 void CloseShell(JNIEnv* env, jclass clazz, jlong shellPtr) { |
105 Shell* shell = reinterpret_cast<Shell*>(shellPtr); | 109 Shell* shell = reinterpret_cast<Shell*>(shellPtr); |
106 shell->Close(); | 110 shell->Close(); |
107 } | 111 } |
108 | 112 |
109 } // namespace content | 113 } // namespace content |
OLD | NEW |