OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_autofill_client.h" | 5 #include "android_webview/native/aw_autofill_client.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_content_browser_client.h" | 8 #include "android_webview/browser/aw_content_browser_client.h" |
9 #include "android_webview/browser/aw_form_database_service.h" | 9 #include "android_webview/browser/aw_form_database_service.h" |
10 #include "android_webview/browser/aw_pref_store.h" | 10 #include "android_webview/browser/aw_pref_store.h" |
11 #include "android_webview/native/aw_contents.h" | 11 #include "android_webview/native/aw_contents.h" |
12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/prefs/pref_service_factory.h" | 18 #include "base/prefs/pref_service_factory.h" |
19 #include "components/autofill/core/browser/autofill_popup_delegate.h" | 19 #include "components/autofill/core/browser/autofill_popup_delegate.h" |
20 #include "components/autofill/core/browser/suggestion.h" | 20 #include "components/autofill/core/browser/suggestion.h" |
21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
22 #include "components/autofill/core/common/autofill_pref_names.h" | 22 #include "components/autofill/core/common/autofill_pref_names.h" |
23 #include "components/user_prefs/user_prefs.h" | 23 #include "components/user_prefs/user_prefs.h" |
| 24 #include "content/public/browser/navigation_entry.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/common/ssl_status.h" |
25 #include "jni/AwAutofillClient_jni.h" | 27 #include "jni/AwAutofillClient_jni.h" |
26 | 28 |
27 using base::android::AttachCurrentThread; | 29 using base::android::AttachCurrentThread; |
28 using base::android::ConvertUTF16ToJavaString; | 30 using base::android::ConvertUTF16ToJavaString; |
29 using base::android::ScopedJavaLocalRef; | 31 using base::android::ScopedJavaLocalRef; |
30 using content::WebContents; | 32 using content::WebContents; |
31 | 33 |
32 DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillClient); | 34 DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillClient); |
33 | 35 |
34 namespace android_webview { | 36 namespace android_webview { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 175 |
174 void AwAutofillClient::OnFirstUserGestureObserved() { | 176 void AwAutofillClient::OnFirstUserGestureObserved() { |
175 NOTIMPLEMENTED(); | 177 NOTIMPLEMENTED(); |
176 } | 178 } |
177 | 179 |
178 void AwAutofillClient::LinkClicked(const GURL& url, | 180 void AwAutofillClient::LinkClicked(const GURL& url, |
179 WindowOpenDisposition disposition) { | 181 WindowOpenDisposition disposition) { |
180 NOTIMPLEMENTED(); | 182 NOTIMPLEMENTED(); |
181 } | 183 } |
182 | 184 |
| 185 bool AwAutofillClient::IsContextSecure(const GURL& form_origin) { |
| 186 content::SSLStatus ssl_status; |
| 187 content::NavigationEntry* navigation_entry = |
| 188 web_contents_->GetController().GetLastCommittedEntry(); |
| 189 if (!navigation_entry) |
| 190 return false; |
| 191 |
| 192 ssl_status = navigation_entry->GetSSL(); |
| 193 // Note: The implementation below is a copy of the one in |
| 194 // ChromeAutofillClient::IsContextSecure, and should be kept in sync |
| 195 // until crbug.com/505388 gets implemented. |
| 196 return ssl_status.security_style == |
| 197 content::SECURITY_STYLE_AUTHENTICATED && |
| 198 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT; |
| 199 } |
| 200 |
183 void AwAutofillClient::SuggestionSelected(JNIEnv* env, | 201 void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
184 jobject object, | 202 jobject object, |
185 jint position) { | 203 jint position) { |
186 if (delegate_) { | 204 if (delegate_) { |
187 delegate_->DidAcceptSuggestion(suggestions_[position].value, | 205 delegate_->DidAcceptSuggestion(suggestions_[position].value, |
188 suggestions_[position].frontend_id, | 206 suggestions_[position].frontend_id, |
189 position); | 207 position); |
190 } | 208 } |
191 } | 209 } |
192 | 210 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 content::RenderFrameHost* rfh, | 244 content::RenderFrameHost* rfh, |
227 const ResultCallback& callback) { | 245 const ResultCallback& callback) { |
228 NOTIMPLEMENTED(); | 246 NOTIMPLEMENTED(); |
229 } | 247 } |
230 | 248 |
231 bool RegisterAwAutofillClient(JNIEnv* env) { | 249 bool RegisterAwAutofillClient(JNIEnv* env) { |
232 return RegisterNativesImpl(env); | 250 return RegisterNativesImpl(env); |
233 } | 251 } |
234 | 252 |
235 } // namespace android_webview | 253 } // namespace android_webview |
OLD | NEW |