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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 720573003: New credential chooser bubble view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/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 b770137eaf0df98f98c0f7b34c6abd375b991135..128b6b501e989aa4df3a44a94729a915c592731a 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/views/passwords/credentials_item_view.h"
#include "chrome/browser/ui/views/passwords/manage_password_item_view.h"
#include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h"
#include "chrome/grit/generated_resources.h"
@@ -171,6 +172,72 @@ void CloseManagePasswordsBubble(content::WebContents* web_contents) {
} // namespace chrome
+// ManagePasswordsBubbleView::AccountChooserView ------------------------------
+
+// A view offering the user the ability to save credentials. Contains a
+// single ManagePasswordItemView, along with a "Save Passwords" button
+// and a rejection combobox. -------------------------------------
Mike West 2014/11/13 10:06:26 Nit: drop the ----- from this line.
vasilii 2014/11/13 12:00:19 The whole comment was pure copy-paste.
+class ManagePasswordsBubbleView::AccountChooserView
+ : public views::View,
+ public views::ButtonListener {
+ public:
+ explicit AccountChooserView(ManagePasswordsBubbleView* parent);
+ ~AccountChooserView() override;
+
+ private:
+ // views::ButtonListener:
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+
+ ManagePasswordsBubbleView* parent_;
+ views::LabelButton* cancel_button_;
+};
+
+ManagePasswordsBubbleView::AccountChooserView::AccountChooserView(
+ ManagePasswordsBubbleView* parent)
+ : parent_(parent) {
+ views::GridLayout* layout = new views::GridLayout(this);
+ SetLayoutManager(layout);
+
+ cancel_button_ =
+ new views::LabelButton(this, l10n_util::GetStringUTF16(IDS_CANCEL));
+ cancel_button_->SetStyle(views::Button::STYLE_BUTTON);
+ cancel_button_->SetFontList(
+ ui::ResourceBundle::GetSharedInstance().GetFontList(
+ ui::ResourceBundle::SmallFont));
+
+ // Title row.
+ BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
+ AddTitleRow(layout, parent_->model());
+
+ for (int i = 0; i < 2; ++i) {
+ base::string16 name =
+ l10n_util::GetStringFUTF16Int(IDS_NUMBERED_PROFILE_NAME, i);
Mike West 2014/11/13 10:06:26 This doesn't seem robust. Is this going to crash i
vasilii 2014/11/13 12:00:19 It just reads the string "User $1" from the resour
+ CredentialsItemView* credential_view = new CredentialsItemView(this, name);
+ // Add the title to the layout with appropriate padding.
+ layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
+ layout->AddView(credential_view);
Mike West 2014/11/13 10:06:26 Where do you plan to handle clicks on individual c
vasilii 2014/11/13 12:00:19 That's a good question. For consistency with other
+ }
+
+ // Button row.
+ BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET);
+ layout->StartRowWithPadding(
+ 0, SINGLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing);
+ layout->AddView(cancel_button_);
+
+ // Extra padding for visual awesomeness.
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+
+ parent_->set_initially_focused_view(cancel_button_);
+}
+
+ManagePasswordsBubbleView::AccountChooserView::~AccountChooserView() {
+}
+
+void ManagePasswordsBubbleView::AccountChooserView::ButtonPressed(
+ views::Button* sender, const ui::Event& event) {
+ parent_->Close();
+}
+
// ManagePasswordsBubbleView::PendingView -------------------------------------
// A view offering the user the ability to save credentials. Contains a

Powered by Google App Engine
This is Rietveld 408576698