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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller.cc

Issue 1234063002: [Smart Lock] Auto sign-in snackbar UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/ui/passwords/manage_passwords_ui_controller.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index eaaf1c8cf4158f04ce2507f1f14e1eb255a966ef..6be754a910924079ddbc1a5e2e5a857e48575a47 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -26,9 +26,12 @@
#include "ui/base/l10n/l10n_util.h"
#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
#include "chrome/browser/android/chrome_application.h"
+#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/password_manager/account_chooser_infobar_delegate_android.h"
+#include "chrome/browser/password_manager/credential_android.h"
#endif
using autofill::PasswordFormMap;
@@ -91,6 +94,27 @@ void ManagePasswordsUIController::
#endif
}
+void ManagePasswordsUIController::UpdateAutoSigninToastVisibility() {
+#if defined(OS_ANDROID)
+ base::android::ScopedJavaLocalRef<jobject> credential;
+ JNIEnv *env = base::android::AttachCurrentThread();
+ if (GetFederatedForms().size() == 1) {
+ credential = CreateNativeCredential(
newt (away) 2015/08/13 16:48:04 Instead of passing the Credential object to Java (
melandory 2015/08/20 15:11:00 Done.
+ env, *GetFederatedForms()[0], 0,
+ static_cast<int>(
+ password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED));
+ } else if (GetCurrentForms().size() == 1) {
+ credential = CreateNativeCredential(
+ env, *GetCurrentForms()[0], 0,
+ static_cast<int>(
+ password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD));
+ }
+ TabAndroid::FromWebContents(web_contents())
+ ->ShowAutoSigninSnackbar(credential.obj());
+ should_pop_up_bubble_ = false;
+#endif
+}
+
base::TimeDelta ManagePasswordsUIController::Elapsed() const {
return timer_ ? timer_->Elapsed() : base::TimeDelta::Max();
}
@@ -140,7 +164,11 @@ void ManagePasswordsUIController::OnAutoSignin(
passwords_data_.OnAutoSignin(local_forms.Pass());
timer_.reset(new base::ElapsedTimer);
base::AutoReset<bool> resetter(&should_pop_up_bubble_, true);
+#if defined(OS_ANDROID)
+ UpdateAutoSigninToastVisibility();
+#else
UpdateBubbleAndIconVisibility();
+#endif
}
void ManagePasswordsUIController::OnAutomaticPasswordSave(

Powered by Google App Engine
This is Rietveld 408576698