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

Unified Diff: chrome/browser/ui/views/login_view.cc

Issue 1466473003: Do not show untrustworthy strings in the basic auth dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/login_view.cc
diff --git a/chrome/browser/ui/views/login_view.cc b/chrome/browser/ui/views/login_view.cc
index 78768e7fe0b91423630c791cb190967307fcc8be..13b86186396fb5335d2b61766296c9affa470c0c 100644
--- a/chrome/browser/ui/views/login_view.cc
+++ b/chrome/browser/ui/views/login_view.cc
@@ -6,6 +6,7 @@
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/views/background.h"
meacer 2015/11/20 00:31:30 Not needed I think
palmer 2015/11/20 01:29:53 Done.
#include "ui/views/controls/label.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/grid_layout.h"
@@ -20,7 +21,8 @@ using views::GridLayout;
///////////////////////////////////////////////////////////////////////////////
// LoginView, public:
-LoginView::LoginView(const base::string16& explanation,
+LoginView::LoginView(const base::string16& authority,
+ const base::string16& explanation,
LoginHandler::LoginModelData* login_model_data)
: username_field_(new views::Textfield()),
password_field_(new views::Textfield()),
@@ -28,9 +30,15 @@ LoginView::LoginView(const base::string16& explanation,
l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD))),
password_label_(new views::Label(
l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD))),
+ authority_label_(new views::Label(authority)),
message_label_(new views::Label(explanation)),
login_model_(login_model_data ? login_model_data->model : nullptr) {
password_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
+
+ authority_label_->SetMultiLine(true);
+ authority_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ authority_label_->SetAllowCharacterBreak(true);
+
message_label_->SetMultiLine(true);
message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
message_label_->SetAllowCharacterBreak(true);
@@ -59,7 +67,12 @@ LoginView::LoginView(const base::string16& explanation,
column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
layout->StartRow(0, single_column_view_set_id);
- layout->AddView(message_label_);
+ layout->AddView(authority_label_);
+ if (!explanation.empty()) {
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ layout->StartRow(0, single_column_view_set_id);
+ layout->AddView(message_label_);
+ }
layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
« chrome/browser/ui/views/login_view.h ('K') | « chrome/browser/ui/views/login_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698