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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/js_result_handler.cc
diff --git a/android_webview/native/js_result_handler.cc b/android_webview/native/js_result_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..56d57dc8a7260a70b69183def9606190f8048b2f
--- /dev/null
+++ b/android_webview/native/js_result_handler.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/native/js_result_handler.h"
+
+#include "base/android/jni_string.h"
+#include "jni/JsResultHandler_jni.h"
+#include "content/public/browser/javascript_dialogs.h"
+#include "content/public/browser/android/content_view_core.h"
+
+using base::android::ConvertJavaStringToUTF16;
+using content::ContentViewCore;
+
+namespace android_webview {
+
+void ConfirmJsResult(JNIEnv* env,
+ jobject obj,
+ jint dialogPointer,
+ jstring promptResult) {
+ content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ =
+ reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>(
+ dialogPointer);
+ string16 prompt_text;
+ if (promptResult) {
+ prompt_text = ConvertJavaStringToUTF16(env, promptResult);
+ }
+ dialog_->Run(true,prompt_text);
+}
+
+void CancelJsResult(JNIEnv* env, jobject obj, jint dialogPointer) {
+ content::JavaScriptDialogCreator::DialogClosedCallback* dialog_ =
+ reinterpret_cast<content::JavaScriptDialogCreator::DialogClosedCallback*>(
+ dialogPointer);
+ dialog_->Run(false, string16());
+}
+
+base::android::ScopedJavaLocalRef<jobject> createJsResultHandler(
+ JNIEnv* env,
+ const content::JavaScriptDialogCreator::DialogClosedCallback* dialog) {
+ return Java_JsResultHandler_create(env, reinterpret_cast<jint>(dialog));
+}
+
+bool RegisterJsResultHandler(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace android_webview
« 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