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

Unified Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 2581493002: PageInfo bubble: Use the non-client view's window title and close button. (Closed)
Patch Set: selfnit: content->website Created 3 years, 12 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/website_settings/website_settings_popup_view.cc
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
index a324f0a761a3d812f912f62f2b9daedaac416a0e..7ed953b2a031b1012d6c3aca93fe68082e8ce73c 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
@@ -112,6 +112,10 @@ const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339;
const int LINK_COOKIE_DIALOG = 1340;
const int LINK_SITE_SETTINGS = 1341;
+// The default, ui::kTitleFontSizeDelta, is too large for the website settings
+// bubble (e.g. +3). Use +1 to obtain a smaller font.
+constexpr int kSummaryFontSizeDelta = 1;
+
} // namespace
// |PopupHeaderView| is the UI element (view) that represents the header of the
@@ -135,9 +139,6 @@ class PopupHeaderView : public views::View {
// The listener for the styled labels in this view.
views::StyledLabelListener* styled_label_listener_;
- // The label that displays security summary for the current page.
- views::Label* summary_label_;
-
// The label that displays the status of the identity check for this site.
// Includes a link to open the Chrome Help Center article about connection
// security.
@@ -184,59 +185,12 @@ PopupHeaderView::PopupHeaderView(
views::ButtonListener* button_listener,
views::StyledLabelListener* styled_label_listener)
: styled_label_listener_(styled_label_listener),
- summary_label_(nullptr),
details_label_(nullptr),
reset_decisions_label_container_(nullptr),
reset_decisions_label_(nullptr) {
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
- const int label_column = 0;
- views::ColumnSet* column_set = layout->AddColumnSet(label_column);
- column_set->AddPaddingColumn(0, kSectionPaddingHorizontal);
- column_set->AddColumn(views::GridLayout::FILL,
- views::GridLayout::FILL,
- 1,
- views::GridLayout::USE_PREF,
- 0,
- 0);
- column_set->AddPaddingColumn(1, 0);
- column_set->AddColumn(views::GridLayout::FILL,
- views::GridLayout::FILL,
- 1,
- views::GridLayout::USE_PREF,
- 0,
- 0);
- column_set->AddPaddingColumn(0, kHeaderPaddingForCloseButton);
-
- // First we add the padding needed for the close button.
- // In order to move down the summary, we simulate additional padding by giving
- // it an empty border on top later on.
- layout->AddPaddingRow(0, kHeaderPaddingForCloseButton);
-
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
-
- layout->StartRow(0, label_column);
- const gfx::FontList& font_list = rb.GetFontListWithDelta(1);
- summary_label_ = new views::Label(base::string16(), font_list);
- summary_label_->SetMultiLine(true);
- summary_label_->SetBorder(views::CreateEmptyBorder(
- kHeaderPaddingTop - kHeaderPaddingForCloseButton, 0, 0, 0));
- layout->AddView(summary_label_, 1, 1, views::GridLayout::LEADING,
- views::GridLayout::TRAILING);
- views::ImageButton* close_button = new views::ImageButton(button_listener);
- close_button->set_id(BUTTON_CLOSE);
- close_button->SetImage(views::CustomButton::STATE_NORMAL,
- rb.GetImageNamed(IDR_CLOSE_2).ToImageSkia());
- close_button->SetImage(views::CustomButton::STATE_HOVERED,
- rb.GetImageNamed(IDR_CLOSE_2_H).ToImageSkia());
- close_button->SetImage(views::CustomButton::STATE_PRESSED,
- rb.GetImageNamed(IDR_CLOSE_2_P).ToImageSkia());
- layout->AddView(close_button, 1, 1, views::GridLayout::TRAILING,
- views::GridLayout::LEADING);
-
- layout->AddPaddingRow(0, kHeaderLabelSpacing);
-
const int label_column_status = 1;
views::ColumnSet* column_set_status =
layout->AddColumnSet(label_column_status);
@@ -266,10 +220,6 @@ PopupHeaderView::PopupHeaderView(
PopupHeaderView::~PopupHeaderView() {}
-void PopupHeaderView::SetSummary(const base::string16& summary_text) {
- summary_label_->SetText(summary_text);
-}
-
void PopupHeaderView::SetDetails(const base::string16& details_text) {
std::vector<base::string16> subst;
subst.push_back(details_text);
@@ -486,6 +436,9 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
// Each section handles its own padding.
set_margins(gfx::Insets(0, 0, kPopupMarginBottom, 0));
+ set_title_margins(gfx::Insets(kHeaderPaddingTop, kSectionPaddingHorizontal,
+ kHeaderLabelSpacing,
+ kHeaderPaddingForCloseButton));
views::BubbleDialogDelegateView::CreateBubble(this);
@@ -517,6 +470,14 @@ void WebsiteSettingsPopupView::OnChosenObjectDeleted(
presenter_->OnSiteChosenObjectDeleted(info.ui_info, *info.object);
}
+base::string16 WebsiteSettingsPopupView::GetWindowTitle() const {
+ return summary_text_;
+}
+
+bool WebsiteSettingsPopupView::ShouldShowCloseButton() const {
+ return true;
+}
+
void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) {
g_shown_popup_type = POPUP_NONE;
presenter_->OnUIClosing();
@@ -526,6 +487,11 @@ int WebsiteSettingsPopupView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
+const gfx::FontList& WebsiteSettingsPopupView::GetTitleFontList() const {
+ return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
+ kSummaryFontSizeDelta);
+}
+
void WebsiteSettingsPopupView::ButtonPressed(views::Button* button,
const ui::Event& event) {
DCHECK_EQ(BUTTON_CLOSE, button->id());
@@ -702,7 +668,8 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
std::unique_ptr<WebsiteSettingsUI::SecurityDescription> security_description =
identity_info.GetSecurityDescription();
- header_->SetSummary(security_description->summary);
+ summary_text_ = security_description->summary;
+ GetWidget()->UpdateWindowTitle();
if (identity_info.certificate) {
certificate_ = identity_info.certificate;

Powered by Google App Engine
This is Rietveld 408576698