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/aw_web_contents_delegate.h" | 5 #include "android_webview/native/aw_web_contents_delegate.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "android_webview/browser/find_helper.h" | 8 #include "android_webview/browser/find_helper.h" |
9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
10 #include "android_webview/native/aw_javascript_dialog_creator.h" | 10 #include "android_webview/native/aw_javascript_dialog_creator.h" |
11 #include "content/public/browser/android/download_controller_android.h" | 11 #include "content/public/browser/android/download_controller_android.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "jni/AwWebContentsDelegate_jni.h" | |
13 #include "net/http/http_request_headers.h" | 14 #include "net/http/http_request_headers.h" |
14 | 15 |
16 using base::android::AttachCurrentThread; | |
15 using content::WebContents; | 17 using content::WebContents; |
16 | 18 |
17 namespace android_webview { | 19 namespace android_webview { |
18 | 20 |
19 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky | 21 static base::LazyInstance<AwJavaScriptDialogCreator>::Leaky |
20 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; | 22 g_javascript_dialog_creator = LAZY_INSTANCE_INITIALIZER; |
21 | 23 |
22 AwWebContentsDelegate::AwWebContentsDelegate( | 24 AwWebContentsDelegate::AwWebContentsDelegate( |
23 JNIEnv* env, | 25 JNIEnv* env, |
24 jobject obj) | 26 jobject obj) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 source, request_id); | 59 source, request_id); |
58 } | 60 } |
59 return false; | 61 return false; |
60 } | 62 } |
61 | 63 |
62 void AwWebContentsDelegate::OnStartDownload(WebContents* source, | 64 void AwWebContentsDelegate::OnStartDownload(WebContents* source, |
63 content::DownloadItem* download) { | 65 content::DownloadItem* download) { |
64 NOTREACHED(); // We always return false in CanDownload. | 66 NOTREACHED(); // We always return false in CanDownload. |
65 } | 67 } |
66 | 68 |
69 void AwWebContentsDelegate::AddNewContents(content::WebContents* source, | |
joth
2012/11/14 18:34:52
this method is spurious: WebContentsDelegateAndroi
| |
70 content::WebContents* new_contents, | |
joth
2012/11/14 18:34:52
wonky indent
benm (inactive)
2012/11/14 18:42:34
Done.
| |
71 WindowOpenDisposition disposition, | |
72 const gfx::Rect& initial_pos, | |
73 bool user_gesture, | |
74 bool* was_blocked) { | |
75 DCHECK(was_blocked); | |
76 JNIEnv* env = AttachCurrentThread(); | |
77 | |
78 // TODO(benm): Need to plumb whether this popup window is a "dialog", for | |
79 // the Classic Android WebViews definition of "dialog". | |
80 bool is_dialog = false; | |
joth
2012/11/14 18:34:52
I'd just say is_dialog = (disposition == NEW_POPUP
benm (inactive)
2012/11/14 18:42:34
Done.
| |
81 bool create_popup = Java_AwWebContentsDelegate_AddNewContents(env, | |
82 GetJavaDelegate(env).obj(), is_dialog, user_gesture); | |
83 | |
84 if (create_popup) { | |
85 // TODO(benm): Implement :) | |
86 NOTIMPLEMENTED() << "Popup windows are currently not supported for" | |
87 << "the chromium powered Android WebView."; | |
88 *was_blocked = true; | |
89 } else { | |
90 *was_blocked = true; | |
91 } | |
92 } | |
93 | |
94 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | |
95 return RegisterNativesImpl(env); | |
96 } | |
97 | |
67 } // namespace android_webview | 98 } // namespace android_webview |
OLD | NEW |