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

Side by Side Diff: android_webview/native/aw_javascript_dialog_creator.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
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/aw_javascript_dialog_creator.h"
6
7 #include "android_webview/native/aw_contents.h"
8 #include "android_webview/native/js_result_handler.h"
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_helper.h"
11 #include "base/android/jni_string.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/logging.h"
14 #include "base/string16.h"
15 #include "content/public/browser/javascript_dialogs.h"
16 #include "content/public/browser/web_contents.h"
17
18 using base::android::AttachCurrentThread;
19 using base::android::ScopedJavaLocalRef;
20
21 namespace android_webview {
22
23 AwJavaScriptDialogCreator::AwJavaScriptDialogCreator() {}
24
25 AwJavaScriptDialogCreator::~AwJavaScriptDialogCreator() {}
26
27 void AwJavaScriptDialogCreator::RunJavaScriptDialog(
28 content::WebContents* web_contents,
29 const GURL& origin_url,
30 const std::string& accept_lang,
31 content::JavaScriptMessageType message_type,
32 const string16& message_text,
33 const string16& default_prompt_text,
34 const DialogClosedCallback& callback,
35 bool* did_suppress_message) {
36 JNIEnv* env = AttachCurrentThread();
37 ScopedJavaLocalRef<jobject> js_result = createJsResultHandler(
38 env,
39 &callback);
40 AwContents* contents = AwContents::FromWebContents(web_contents);
41 contents->RunJavaScriptDialog(message_type, origin_url, message_text,
42 default_prompt_text, js_result);
43 }
44
45 void AwJavaScriptDialogCreator::RunBeforeUnloadDialog(
46 content::WebContents* web_contents,
47 const string16& message_text,
48 bool is_reload,
49 const DialogClosedCallback& callback) {
50 JNIEnv* env = AttachCurrentThread();
51 ScopedJavaLocalRef<jobject> js_result = createJsResultHandler(
52 env,
53 &callback);
54 AwContents* contents = AwContents::FromWebContents(web_contents);
55 contents->RunBeforeUnloadDialog(web_contents->GetURL(), message_text,
56 js_result);
57 }
58
59 void AwJavaScriptDialogCreator::ResetJavaScriptState(
60 content::WebContents* web_contents) {
61 }
62
63 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_javascript_dialog_creator.h ('k') | android_webview/native/aw_web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698