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

Unified 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: Rebaised on top of master. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/account_chooser_infobar_delegate_android.cc
diff --git a/chrome/browser/password_manager/account_chooser_infobar_delegate_android.cc b/chrome/browser/password_manager/account_chooser_infobar_delegate_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..472097428f8081779438030af7f5244afa6e1d22
--- /dev/null
+++ b/chrome/browser/password_manager/account_chooser_infobar_delegate_android.cc
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
vabr (Chromium) 2015/02/04 08:43:07 2015
melandory 2015/02/04 15:58:49 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/password_manager/account_chooser_infobar_delegate_android.h"
+
+#include <cstddef>
vabr (Chromium) 2015/02/04 08:43:07 Please go through the #includes and check which of
melandory 2015/02/04 15:58:49 Done.
+
+#include "chrome/browser/android/chromium_application.h"
+#include "chrome/grit/generated_resources.h"
+#include "chrome/grit/theme_resources.h"
+#include "components/autofill/core/common/password_form.h"
+#include "components/password_manager/content/common/credential_manager_types.h"
+#include "ui/base/l10n/l10n_util.h"
+
+AccountChooserInfoBarDelegateAndroid::AccountChooserInfoBarDelegateAndroid(
+ ManagePasswordsUIController* ui_controller)
+ : ui_controller_(ui_controller) {
+}
+
+void AccountChooserInfoBarDelegateAndroid::choose_credential(
+ unsigned int credential_index,
+ password_manager::CredentialType credential_type) {
+ autofill::PasswordForm* form = new autofill::PasswordForm();
vabr (Chromium) 2015/02/04 08:43:07 Please use scoped_vector to hold the allocated for
melandory 2015/02/04 15:58:49 Actually, I do not need to allocate form. Done.
+ if (credential_type ==
+ password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL) {
+ if (credential_index < ui_controller_->local_credentials_forms().size()) {
+ form = ui_controller_->local_credentials_forms()[credential_index];
vabr (Chromium) 2015/02/04 08:43:07 Is this a memory leak? (Also line 34.)
melandory 2015/02/04 15:58:49 Done.
+ }
+ } else if (credential_type ==
+ password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED) {
+ if (credential_index <
+ ui_controller_->federated_credentials_forms().size()) {
+ form = ui_controller_->federated_credentials_forms()[credential_index];
+ }
+ }
+
+ ui_controller_->ChooseCredential(*form, credential_type);
vabr (Chromium) 2015/02/04 08:43:07 Is this a memory leak?
melandory 2015/02/04 15:58:49 Done.
+}
+
+AccountChooserInfoBarDelegateAndroid*
+AccountChooserInfoBarDelegateAndroid::AsAccountChooserInfoBarDelegateAndroid() {
+ return this;
+}
+
+infobars::InfoBarDelegate::Type
+AccountChooserInfoBarDelegateAndroid::GetInfoBarType() const {
+ return PAGE_ACTION_TYPE;
+}

Powered by Google App Engine
This is Rietveld 408576698