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 "android_webview/native/js_result_handler.h" | 5 #include "android_webview/native/js_result_handler.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "content/public/browser/android/content_view_core.h" |
| 9 #include "content/public/browser/javascript_dialog_manager.h" |
8 #include "jni/JsResultHandler_jni.h" | 10 #include "jni/JsResultHandler_jni.h" |
9 #include "content/public/browser/javascript_dialogs.h" | |
10 #include "content/public/browser/android/content_view_core.h" | |
11 | 11 |
12 using base::android::ConvertJavaStringToUTF16; | 12 using base::android::ConvertJavaStringToUTF16; |
13 using content::ContentViewCore; | 13 using content::ContentViewCore; |
14 | 14 |
15 namespace android_webview { | 15 namespace android_webview { |
16 | 16 |
17 void ConfirmJsResult(JNIEnv* env, | 17 void ConfirmJsResult(JNIEnv* env, |
18 jobject obj, | 18 jobject obj, |
19 jint dialogPointer, | 19 jint dialogPointer, |
20 jstring promptResult) { | 20 jstring promptResult) { |
21 content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ = | 21 content::JavaScriptDialogManager::DialogClosedCallback* dialog_ = |
22 reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>( | 22 reinterpret_cast<content::JavaScriptDialogManager::DialogClosedCallback*>( |
23 dialogPointer); | 23 dialogPointer); |
24 string16 prompt_text; | 24 string16 prompt_text; |
25 if (promptResult) { | 25 if (promptResult) { |
26 prompt_text = ConvertJavaStringToUTF16(env, promptResult); | 26 prompt_text = ConvertJavaStringToUTF16(env, promptResult); |
27 } | 27 } |
28 dialog_->Run(true,prompt_text); | 28 dialog_->Run(true,prompt_text); |
29 } | 29 } |
30 | 30 |
31 void CancelJsResult(JNIEnv* env, jobject obj, jint dialogPointer) { | 31 void CancelJsResult(JNIEnv* env, jobject obj, jint dialogPointer) { |
32 content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ = | 32 content::JavaScriptDialogManager::DialogClosedCallback* dialog_ = |
33 reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>( | 33 reinterpret_cast<content::JavaScriptDialogManager::DialogClosedCallback*>( |
34 dialogPointer); | 34 dialogPointer); |
35 dialog_->Run(false, string16()); | 35 dialog_->Run(false, string16()); |
36 } | 36 } |
37 | 37 |
38 base::android::ScopedJavaLocalRef<jobject> createJsResultHandler( | 38 base::android::ScopedJavaLocalRef<jobject> createJsResultHandler( |
39 JNIEnv* env, | 39 JNIEnv* env, |
40 const content::JavaScriptDialogCreator::DialogClosedCallback* dialog) { | 40 const content::JavaScriptDialogManager::DialogClosedCallback* dialog) { |
41 return Java_JsResultHandler_create(env, reinterpret_cast<jint>(dialog)); | 41 return Java_JsResultHandler_create(env, reinterpret_cast<jint>(dialog)); |
42 } | 42 } |
43 | 43 |
44 bool RegisterJsResultHandler(JNIEnv* env) { | 44 bool RegisterJsResultHandler(JNIEnv* env) { |
45 return RegisterNativesImpl(env); | 45 return RegisterNativesImpl(env); |
46 } | 46 } |
47 | 47 |
48 } // namespace android_webview | 48 } // namespace android_webview |
OLD | NEW |