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

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

Issue 1701363002: Change the account chooser on Win to look like in the mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
index f7826d672c02a38d34afed73b3ada84dd46237ea..8a08e2e34ae5301ad13bc4e8a90ec1c1da3a49fd 100644
--- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
+++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
@@ -23,22 +23,28 @@
namespace {
+const int kVerticalAvatarMargin = 8;
+
// An identifier for views::ColumnSet.
enum ColumnSetType {
SINGLE_VIEW_COLUMN_SET,
+ SINGLE_VIEW_COLUMN_SET_NO_PADDING,
};
-// Construct a SINGLE_VIEW_COLUMN_SET ColumnSet and add it to |layout|.
-void BuildOneColumnSet(views::GridLayout* layout) {
- views::ColumnSet* column_set = layout->AddColumnSet(SINGLE_VIEW_COLUMN_SET);
- column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
+// Construct a |type| ColumnSet and add it to |layout|.
+void BuildColumnSet(ColumnSetType type, views::GridLayout* layout) {
+ views::ColumnSet* column_set = layout->AddColumnSet(type);
+ bool padding = (type == SINGLE_VIEW_COLUMN_SET);
+ if (padding)
+ column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
column_set->AddColumn(views::GridLayout::FILL,
views::GridLayout::FILL,
1,
views::GridLayout::USE_PREF,
0,
0);
- column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
+ if (padding)
+ column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
}
views::StyledLabel::RangeStyleInfo GetLinkStyle() {
@@ -120,14 +126,15 @@ void AccountChooserDialogView::StyledLabelLinkClicked(views::StyledLabel* label,
void AccountChooserDialogView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
CredentialsItemView* view = static_cast<CredentialsItemView*>(sender);
- controller_->OnChooseCredentials(*view->form(),
- view->credential_type());
+ controller_->OnChooseCredentials(
+ *view->form(),
+ password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
}
void AccountChooserDialogView::InitWindow() {
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- BuildOneColumnSet(layout);
+ BuildColumnSet(SINGLE_VIEW_COLUMN_SET, layout);
// Create the title.
std::pair<base::string16, gfx::Range> title_content =
@@ -147,6 +154,7 @@ void AccountChooserDialogView::InitWindow() {
// Show credentials.
net::URLRequestContextGetter* request_context =
GetProfileFromWebContents(web_contents_)->GetRequestContext();
+ BuildColumnSet(SINGLE_VIEW_COLUMN_SET_NO_PADDING, layout);
for (const auto& form : controller_->GetLocalForms()) {
const base::string16& upper_string =
form->display_name.empty() ? form->username_value : form->display_name;
@@ -159,11 +167,15 @@ void AccountChooserDialogView::InitWindow() {
IDS_PASSWORDS_VIA_FEDERATION,
base::UTF8ToUTF16(form->federation_url.host()));
}
- layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
- layout->AddView(new CredentialsItemView(
- this, form.get(),
- password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD,
- upper_string, lower_string, request_context));
+ layout->StartRow(0, SINGLE_VIEW_COLUMN_SET_NO_PADDING);
+ CredentialsItemView* view = new CredentialsItemView(
+ this, upper_string, lower_string, kButtonHoverColor,
+ form.get(), request_context);
+ view->SetLowerLabelColor(kAutoSigninTextColor);
+ view->SetBorder(views::Border::CreateEmptyBorder(
+ kVerticalAvatarMargin, views::kButtonHEdgeMarginNew,
+ kVerticalAvatarMargin, views::kButtonHEdgeMarginNew));
+ layout->AddView(view);
}
// DialogClientView adds kRelatedControlVerticalSpacing padding once more for
// the buttons.
« no previous file with comments | « chrome/browser/ui/passwords/password_dialog_prompts.h ('k') | chrome/browser/ui/views/passwords/credentials_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698