Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
index eea0fb7d3e92d27b96f6c0ecd2ab57faf6408918..698b54431003743a7dcd7b9a85a771cc826b21f2 100644 |
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
+#include "base/timer/timer.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_finder.h" |
@@ -39,6 +40,7 @@ |
namespace { |
+const int kAutoSigninToastTimeout = 5; |
const int kDesiredBubbleWidth = 370; |
enum ColumnSetType { |
@@ -246,8 +248,9 @@ void ManagePasswordsBubbleView::AccountChooserView::AddCredentialItemsWithType( |
for (autofill::PasswordForm* form : password_forms) { |
// Add the title to the layout with appropriate padding. |
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
- layout->AddView( |
- new CredentialsItemView(this, *form, type, request_context)); |
+ layout->AddView(new CredentialsItemView( |
+ this, *form, type, CredentialsItemView::ACCOUNT_CHOOSER, |
+ request_context)); |
} |
} |
@@ -265,6 +268,54 @@ void ManagePasswordsBubbleView::AccountChooserView::ButtonPressed( |
parent_->Close(); |
} |
+// ManagePasswordsBubbleView::AccountChooserView ------------------------------ |
Mike West
2015/02/18 22:28:04
Nit: AccountChooserView -> AutoSignInView
vasilii
2015/02/19 09:37:34
Done.
|
+ |
+// A view offering the user the ability to choose credentials for |
+// authentication. Contains a list of CredentialsItemView, along with a |
+// "Cancel" button. |
Mike West
2015/02/18 22:28:04
Nit: Please update this comment as well.
vasilii
2015/02/19 09:37:34
Done.
|
+class ManagePasswordsBubbleView::AutoSigninView |
+ : public views::View, |
+ public views::ButtonListener { |
+ public: |
+ explicit AutoSigninView(ManagePasswordsBubbleView* parent); |
+ |
+ private: |
+ // views::ButtonListener: |
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
+ |
+ void OnTimer(); |
+ |
+ base::OneShotTimer<AutoSigninView> timer_; |
+ ManagePasswordsBubbleView* parent_; |
+}; |
+ |
+ManagePasswordsBubbleView::AutoSigninView::AutoSigninView( |
+ ManagePasswordsBubbleView* parent) |
+ : parent_(parent) { |
+ SetLayoutManager(new views::FillLayout); |
+ CredentialsItemView* credential = new CredentialsItemView( |
+ this, |
+ parent_->model()->pending_password(), |
+ password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL, |
+ CredentialsItemView::AUTO_SIGNIN, |
+ parent_->model()->GetProfile()->GetRequestContext()); |
+ AddChildView(credential); |
+ credential->SetEnabled(false); |
Mike West
2015/02/18 22:28:04
// TODO?
vasilii
2015/02/19 09:37:34
Done.
|
+ parent_->set_initially_focused_view(credential); |
+ |
+ timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kAutoSigninToastTimeout), |
+ this, &AutoSigninView::OnTimer); |
+} |
+ |
+void ManagePasswordsBubbleView::AutoSigninView::ButtonPressed( |
+ views::Button* sender, const ui::Event& event) { |
+} |
Mike West
2015/02/18 22:28:04
// TODO?
vasilii
2015/02/19 09:37:34
Done.
|
+ |
+void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { |
+ parent_->model()->OnAutoSignInToastTimeout(); |
+ parent_->Close(); |
+} |
+ |
// ManagePasswordsBubbleView::AskUserToSubmitURLView ------------------------- |
// Asks users if they want to report the URL when the password manager failed |
@@ -974,6 +1025,8 @@ void ManagePasswordsBubbleView::Refresh() { |
} else if (model()->state() == |
password_manager::ui::CREDENTIAL_REQUEST_STATE) { |
AddChildView(new AccountChooserView(this)); |
+ } else if (model()->state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
Mike West
2015/02/18 22:28:04
Did the previous CL change the state back to MANAG
vasilii
2015/02/19 09:37:34
Just talk. In the previous CL I saved all the form
|
+ AddChildView(new AutoSigninView(this)); |
} else { |
AddChildView(new ManageView(this)); |
} |