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

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 "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/browser/ui/android/infobars/account_chooser_infobar.h"
9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/common/credential_manager_types.h"
11
12 // static
13 void AccountChooserInfoBarDelegateAndroid::Create(
14 InfoBarService* infobar_service,
15 ManagePasswordsUIController* ui_controller) {
16 infobar_service->AddInfoBar(
17 make_scoped_ptr(new AccountChooserInfoBar(make_scoped_ptr(
18 new AccountChooserInfoBarDelegateAndroid(ui_controller)))));
19 }
20
21 AccountChooserInfoBarDelegateAndroid::AccountChooserInfoBarDelegateAndroid(
22 ManagePasswordsUIController* ui_controller)
23 : ui_controller_(ui_controller) {
24 }
25
26 AccountChooserInfoBarDelegateAndroid::~AccountChooserInfoBarDelegateAndroid() {
27 }
28
29 void AccountChooserInfoBarDelegateAndroid::ChooseCredential(
30 size_t credential_index,
31 password_manager::CredentialType credential_type) {
32 using namespace password_manager;
Mike West 2015/02/19 10:06:17 Nit: I don't think we generally do this sort of sc
Mike West 2015/02/19 10:06:17 Nit: I don't think we generally do this sort of sc
Peter Kasting 2015/02/19 10:24:24 I'm OK with it if it makes the code below noticeab
33 if (credential_type == CredentialType::CREDENTIAL_TYPE_EMPTY) {
34 ui_controller_->ChooseCredential(autofill::PasswordForm(), credential_type);
35 return;
36 }
37 DCHECK(credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL ||
38 credential_type == CredentialType::CREDENTIAL_TYPE_FEDERATED);
39 auto& credentials_forms =
40 (credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL)
Mike West 2015/02/19 10:06:17 Nit: You don't need the () here.
Peter Kasting 2015/02/19 10:24:24 No, but I think it makes things a little more read
41 ? ui_controller_->local_credentials_forms()
42 : ui_controller_->federated_credentials_forms();
43 if (credential_index < credentials_forms.size()) {
44 ui_controller_->ChooseCredential(*credentials_forms[credential_index],
45 credential_type);
46 }
47 }
48
49 infobars::InfoBarDelegate::Type
50 AccountChooserInfoBarDelegateAndroid::GetInfoBarType() const {
51 return PAGE_ACTION_TYPE;
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698