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

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: Fix XIB. Created 5 years 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
« no previous file with comments | « chrome/browser/ui/views/login_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e88d3de6c464d34f7fd324e3e6cdc0dcb652ca4c 100644
--- a/chrome/browser/ui/views/login_view.cc
+++ b/chrome/browser/ui/views/login_view.cc
@@ -20,7 +20,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,12 +29,14 @@ 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))),
- message_label_(new views::Label(explanation)),
+ authority_label_(new views::Label(authority)),
+ message_label_(nullptr),
login_model_(login_model_data ? login_model_data->model : nullptr) {
password_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
- message_label_->SetMultiLine(true);
- message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- message_label_->SetAllowCharacterBreak(true);
+
+ authority_label_->SetMultiLine(true);
+ authority_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ authority_label_->SetAllowCharacterBreak(true);
// Initialize the Grid Layout Manager used for this dialog box.
GridLayout* layout = GridLayout::CreatePanel(this);
@@ -59,7 +62,16 @@ 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()) {
+ message_label_ = new views::Label(explanation);
+ message_label_->SetMultiLine(true);
+ message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ message_label_->SetAllowCharacterBreak(true);
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ layout->StartRow(0, single_column_view_set_id);
+ layout->AddView(message_label_);
+ }
layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
« no previous file with comments | « 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