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

Side by Side Diff: chrome/browser/android/password_authentication_manager.cc

Issue 170783005: Always call into the embedder for password autofill auth if password uses it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove assert in requestAuthentication. Created 6 years, 10 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
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 "chrome/browser/android/password_authentication_manager.h" 5 #include "chrome/browser/android/password_authentication_manager.h"
6 6
7 #include "chrome/browser/android/tab_android.h" 7 #include "chrome/browser/android/tab_android.h"
8 #include "jni/PasswordAuthenticationManager_jni.h" 8 #include "jni/PasswordAuthenticationManager_jni.h"
9 9
10 namespace { 10 namespace {
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 PasswordAuthenticationManager::~PasswordAuthenticationManager() { 36 PasswordAuthenticationManager::~PasswordAuthenticationManager() {
37 } 37 }
38 38
39 bool PasswordAuthenticationManager::RegisterPasswordAuthenticationManager( 39 bool PasswordAuthenticationManager::RegisterPasswordAuthenticationManager(
40 JNIEnv* env) { 40 JNIEnv* env) {
41 return RegisterNativesImpl(env); 41 return RegisterNativesImpl(env);
42 } 42 }
43 43
44 bool PasswordAuthenticationManager::IsAutofillPasswordAuthenticationEnabled() {
45 return Java_PasswordAuthenticationManager_isPasswordAuthenticationEnabled(
46 base::android::AttachCurrentThread());
47 }
48
49 void PasswordAuthenticationManager::AuthenticatePasswordAutofill( 44 void PasswordAuthenticationManager::AuthenticatePasswordAutofill(
50 content::WebContents* web_contents, 45 content::WebContents* web_contents,
51 const base::Closure& success_callback) { 46 const base::Closure& success_callback) {
52 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); 47 TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
53 if (!tab) 48 if (!tab)
54 return; 49 return;
55 50
56 JNIEnv* env = base::android::AttachCurrentThread(); 51 JNIEnv* env = base::android::AttachCurrentThread();
57 PasswordAuthenticationCallback* auth_callback = 52 PasswordAuthenticationCallback* auth_callback =
58 new PasswordAuthenticationCallback(success_callback); 53 new PasswordAuthenticationCallback(success_callback);
59 Java_PasswordAuthenticationManager_requestAuthentication( 54 Java_PasswordAuthenticationManager_requestAuthentication(
60 env, 55 env,
61 tab->GetJavaObject().obj(), 56 tab->GetJavaObject().obj(),
62 Java_PasswordAuthenticationCallback_create( 57 Java_PasswordAuthenticationCallback_create(
63 env, 58 env,
64 reinterpret_cast<intptr_t>(auth_callback)).obj()); 59 reinterpret_cast<intptr_t>(auth_callback)).obj());
65 } 60 }
66 61
67 // static 62 // static
68 void OnResult(JNIEnv* env, 63 void OnResult(JNIEnv* env,
69 jclass jcaller, 64 jclass jcaller,
70 jlong callback_ptr, 65 jlong callback_ptr,
71 jboolean authenticated) { 66 jboolean authenticated) {
72 PasswordAuthenticationCallback* callback = 67 PasswordAuthenticationCallback* callback =
73 reinterpret_cast<PasswordAuthenticationCallback*>(callback_ptr); 68 reinterpret_cast<PasswordAuthenticationCallback*>(callback_ptr);
74 callback->OnResult(authenticated); 69 callback->OnResult(authenticated);
75 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698