Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: android_webview/native/js_result_handler.cc

Issue 10907166: Upstream chromium side of modal dialogs for webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/native/js_result_handler.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "android_webview/native/js_result_handler.h"
6
7 #include "base/android/jni_string.h"
8 #include "jni/JsResultHandler_jni.h"
9 #include "content/public/browser/javascript_dialogs.h"
10 #include "content/public/browser/android/content_view_core.h"
11
12 using base::android::ConvertJavaStringToUTF16;
13 using content::ContentViewCore;
14
15 namespace android_webview {
16
17 void ConfirmJsResult(JNIEnv* env,
18 jobject obj,
19 jint dialogPointer,
20 jstring promptResult) {
21 content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ =
22 reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>(
23 dialogPointer);
24 string16 prompt_text;
25 if (promptResult) {
26 prompt_text = ConvertJavaStringToUTF16(env, promptResult);
27 }
28 dialog_->Run(true,prompt_text);
29 }
30
31 void CancelJsResult(JNIEnv* env, jobject obj, jint dialogPointer) {
32 content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ =
33 reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>(
34 dialogPointer);
35 dialog_->Run(false, string16());
36 }
37
38 base::android::ScopedJavaLocalRef<jobject> createJsResultHandler(
39 JNIEnv* env,
40 const content::JavaScriptDialogCreator::DialogClosedCallback* dialog) {
41 return Java_JsResultHandler_create(env, reinterpret_cast<jint>(dialog));
42 }
43
44 bool RegisterJsResultHandler(JNIEnv* env) {
45 return RegisterNativesImpl(env);
46 }
47
48 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/js_result_handler.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698