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

Side by Side Diff: chrome/browser/password_manager/account_chooser_infobar_delegate_android.cc

Issue 861103002: Credentials chooser UI for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/password_manager/account_chooser_infobar_delegate_andro id.h"
6
7 #include <cstddef>
Peter Kasting 2015/02/16 20:37:07 You don't need this.
melandory 2015/02/17 16:16:57 Done.
8
9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/common/credential_manager_types.h"
11
12 AccountChooserInfoBarDelegateAndroid::AccountChooserInfoBarDelegateAndroid(
13 ManagePasswordsUIController* ui_controller)
14 : ui_controller_(ui_controller) {
15 }
16
17 void AccountChooserInfoBarDelegateAndroid::choose_credential(
18 unsigned int credential_index,
19 password_manager::CredentialType credential_type) {
20 using namespace password_manager;
21 const size_t federated_credentials_size =
22 ui_controller_->federated_credentials_forms().size();
23 const size_t local_credentials_size =
24 ui_controller_->local_credentials_forms().size();
25 autofill::PasswordForm* password_form = nullptr;
26 if (credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL &&
27 credential_index < local_credentials_size) {
28 password_form = ui_controller_->local_credentials_forms()[credential_index];
29 } else if (credential_type == CredentialType::CREDENTIAL_TYPE_FEDERATED &&
30 credential_index < federated_credentials_size) {
31 password_form =
32 ui_controller_->federated_credentials_forms()[credential_index];
33 }
34 if (password_form)
35 ui_controller_->ChooseCredential(*password_form, credential_type);
Peter Kasting 2015/02/16 20:37:07 Nit: Simpler: if ((credential_type != Credentia
melandory 2015/02/17 16:16:57 Great! I didn't like my code, but nothing more ele
36 }
37
38 AccountChooserInfoBarDelegateAndroid*
39 AccountChooserInfoBarDelegateAndroid::AsAccountChooserInfoBarDelegateAndroid() {
40 return this;
41 }
42
43 infobars::InfoBarDelegate::Type
44 AccountChooserInfoBarDelegateAndroid::GetInfoBarType() const {
45 return PAGE_ACTION_TYPE;
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698