| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/account_chooser_dialog_android.h" | 5 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 base::android::ScopedJavaLocalRef<jobject> java_dialog(java_dialog_global); | 147 base::android::ScopedJavaLocalRef<jobject> java_dialog(java_dialog_global); |
| 148 net::URLRequestContextGetter* request_context = | 148 net::URLRequestContextGetter* request_context = |
| 149 Profile::FromBrowserContext(web_contents_->GetBrowserContext()) | 149 Profile::FromBrowserContext(web_contents_->GetBrowserContext()) |
| 150 ->GetRequestContext(); | 150 ->GetRequestContext(); |
| 151 FetchAvatars(java_dialog_global, local_credentials_forms(), 0, | 151 FetchAvatars(java_dialog_global, local_credentials_forms(), 0, |
| 152 request_context); | 152 request_context); |
| 153 FetchAvatars(java_dialog_global, federated_credentials_forms(), | 153 FetchAvatars(java_dialog_global, federated_credentials_forms(), |
| 154 local_credentials_forms().size(), request_context); | 154 local_credentials_forms().size(), request_context); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void AccountChooserDialogAndroid::OnCredentialClicked(JNIEnv* env, | 157 void AccountChooserDialogAndroid::OnCredentialClicked( |
| 158 jobject obj, | 158 JNIEnv* env, |
| 159 jint credential_item, | 159 const JavaParamRef<jobject>& obj, |
| 160 jint credential_type) { | 160 jint credential_item, |
| 161 jint credential_type) { |
| 161 ChooseCredential( | 162 ChooseCredential( |
| 162 credential_item, | 163 credential_item, |
| 163 static_cast<password_manager::CredentialType>(credential_type)); | 164 static_cast<password_manager::CredentialType>(credential_type)); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void AccountChooserDialogAndroid::Destroy(JNIEnv* env, jobject obj) { | 167 void AccountChooserDialogAndroid::Destroy(JNIEnv* env, |
| 168 const JavaParamRef<jobject>& obj) { |
| 167 delete this; | 169 delete this; |
| 168 } | 170 } |
| 169 | 171 |
| 170 void AccountChooserDialogAndroid::CancelDialog(JNIEnv* env, jobject obj) { | 172 void AccountChooserDialogAndroid::CancelDialog( |
| 173 JNIEnv* env, |
| 174 const JavaParamRef<jobject>& obj) { |
| 171 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY); | 175 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY); |
| 172 } | 176 } |
| 173 | 177 |
| 174 void AccountChooserDialogAndroid::OnLinkClicked(JNIEnv* env, jobject obj) { | 178 void AccountChooserDialogAndroid::OnLinkClicked( |
| 179 JNIEnv* env, |
| 180 const JavaParamRef<jobject>& obj) { |
| 175 web_contents_->OpenURL(content::OpenURLParams( | 181 web_contents_->OpenURL(content::OpenURLParams( |
| 176 GURL(password_manager::kPasswordManagerAccountDashboardURL), | 182 GURL(password_manager::kPasswordManagerAccountDashboardURL), |
| 177 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 183 content::Referrer(), NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 178 false /* is_renderer_initiated */)); | 184 false /* is_renderer_initiated */)); |
| 179 } | 185 } |
| 180 | 186 |
| 181 const std::vector<const autofill::PasswordForm*>& | 187 const std::vector<const autofill::PasswordForm*>& |
| 182 AccountChooserDialogAndroid::local_credentials_forms() const { | 188 AccountChooserDialogAndroid::local_credentials_forms() const { |
| 183 return passwords_data_.GetCurrentForms(); | 189 return passwords_data_.GetCurrentForms(); |
| 184 } | 190 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 203 ? local_credentials_forms() | 209 ? local_credentials_forms() |
| 204 : federated_credentials_forms(); | 210 : federated_credentials_forms(); |
| 205 if (index < credentials_forms.size()) { | 211 if (index < credentials_forms.size()) { |
| 206 passwords_data_.ChooseCredential(*credentials_forms[index], type); | 212 passwords_data_.ChooseCredential(*credentials_forms[index], type); |
| 207 } | 213 } |
| 208 } | 214 } |
| 209 | 215 |
| 210 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { | 216 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { |
| 211 return RegisterNativesImpl(env); | 217 return RegisterNativesImpl(env); |
| 212 } | 218 } |
| OLD | NEW |