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

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: const Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/website_settings/website_settings_popup_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/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..376ab030fa3c3e66a344cf8150f54f54b2ad5a0f 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
@@ -55,6 +55,7 @@
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/grid_layout.h"
+#include "ui/views/layout/layout_constants.h"
#include "ui/views/layout/layout_manager.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
@@ -78,18 +79,16 @@ const int kMinPopupWidth = 320;
const int kMaxPopupWidth = 1000;
// Margin and padding values shared by all sections.
-const int kSectionPaddingHorizontal = 16;
+const int kSectionPaddingHorizontal = views::kPanelHorizMargin;
// Padding for the bottom of the bubble.
-const int kPopupMarginBottom = 16;
+const int kPopupMarginBottom = views::kPanelVertMargin;
// Security Section (PopupHeaderView) ------------------------------------------
// Margin and padding values for the |PopupHeaderView|.
const int kHeaderMarginBottom = 10;
-const int kHeaderPaddingBottom = 16;
-const int kHeaderPaddingTop = 16;
-const int kHeaderPaddingForCloseButton = 8;
+const int kHeaderPaddingBottom = views::kPanelVertMargin;
// Spacing between labels in the header.
const int kHeaderLabelSpacing = 4;
@@ -112,6 +111,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 +138,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 +184,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 +219,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,7 +435,6 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
// Each section handles its own padding.
set_margins(gfx::Insets(0, 0, kPopupMarginBottom, 0));
-
views::BubbleDialogDelegateView::CreateBubble(this);
presenter_.reset(new WebsiteSettings(
@@ -517,6 +465,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 +482,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 +663,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;
« no previous file with comments | « chrome/browser/ui/views/website_settings/website_settings_popup_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698