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

Unified Diff: chrome/browser/ui/views/page_info/page_info_bubble_view.cc

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: comments 3 Created 3 years, 6 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/page_info/page_info_bubble_view.cc
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
index 645b9fa845bad28c89d3308343f6f3eeadb88520..2a52212559f2562babc0864b190bc559d4ca5cbe 100644
--- a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
+++ b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
@@ -45,6 +45,7 @@
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/image/image.h"
#include "ui/views/border.h"
+#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
@@ -435,6 +436,7 @@ PageInfoBubbleView::PageInfoBubbleView(
BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT),
profile_(profile),
header_(nullptr),
+ title_(nullptr),
separator_(nullptr),
site_settings_view_(nullptr),
cookie_dialog_link_(nullptr),
@@ -534,6 +536,15 @@ base::string16 PageInfoBubbleView::GetWindowTitle() const {
return summary_text_;
}
+void PageInfoBubbleView::AddedToWidget() {
+ title_ = views::BubbleFrameView::CreateDefaultTitleLabel(GetWindowTitle())
+ .release();
+ title_->SetFontList(
+ ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
+ kSummaryFontSizeDelta));
+ GetBubbleFrameView()->SetTitleView(title_);
Peter Kasting 2017/06/23 06:00:09 SetTitleView() basically "takes ownership" of this
Bret 2017/06/24 01:12:33 Done.
+}
+
bool PageInfoBubbleView::ShouldShowCloseButton() const {
return true;
}
@@ -548,11 +559,6 @@ int PageInfoBubbleView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
-const gfx::FontList& PageInfoBubbleView::GetTitleFontList() const {
- return ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
- kSummaryFontSizeDelta);
-}
-
void PageInfoBubbleView::ButtonPressed(views::Button* button,
const ui::Event& event) {
DCHECK_EQ(VIEW_ID_PAGE_INFO_BUTTON_CLOSE, button->id());
@@ -682,7 +688,7 @@ void PageInfoBubbleView::SetIdentityInfo(const IdentityInfo& identity_info) {
identity_info.GetSecurityDescription();
summary_text_ = security_description->summary;
- GetWidget()->UpdateWindowTitle();
+ title_->SetText(GetWindowTitle());
Peter Kasting 2017/06/23 06:00:09 If the BubbleFrameView exposed the title() methods
Bret 2017/06/24 01:12:32 The new patchset has this version. I'm not sure wh
if (identity_info.certificate) {
certificate_ = identity_info.certificate;

Powered by Google App Engine
This is Rietveld 408576698