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

Unified Diff: ui/views/bubble/bubble_dialog_delegate.cc

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: pass strings by reference 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: ui/views/bubble/bubble_dialog_delegate.cc
diff --git a/ui/views/bubble/bubble_dialog_delegate.cc b/ui/views/bubble/bubble_dialog_delegate.cc
index b8be537b9912cb78562f726d0e441f52bab0c8e4..9a19c4197b96567c0aefc6a546549874378bffb1 100644
--- a/ui/views/bubble/bubble_dialog_delegate.cc
+++ b/ui/views/bubble/bubble_dialog_delegate.cc
@@ -106,9 +106,6 @@ ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) {
NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView(
Widget* widget) {
BubbleFrameView* frame = new BubbleFrameView(title_margins_, margins_);
- // Note: In CreateBubble, the call to SizeToContents() will cause
- // the relayout that this call requires.
- frame->SetTitleFontList(GetTitleFontList());
frame->SetFootnoteView(CreateFootnoteView());
BubbleBorder::Arrow adjusted_arrow = arrow();
@@ -123,6 +120,10 @@ const char* BubbleDialogDelegateView::GetClassName() const {
return kViewClassName;
}
+void BubbleDialogDelegateView::AddedToWidget() {
+ SetupTitleView();
+}
+
void BubbleDialogDelegateView::OnWidgetDestroying(Widget* widget) {
if (anchor_widget() == widget)
SetAnchorView(NULL);
@@ -234,11 +235,15 @@ gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() {
adjust_if_offscreen_ && !anchor_minimized);
}
-const gfx::FontList& BubbleDialogDelegateView::GetTitleFontList() const {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return rb.GetFontListWithDelta(ui::kTitleFontSizeDelta);
- return rb.GetFontList(ui::ResourceBundle::MediumFont);
+View* BubbleDialogDelegateView::CreateTitleView(
+ const base::string16& title_text) {
+ return nullptr;
+}
+
+void BubbleDialogDelegateView::SetupTitleView() {
+ View* title_view = CreateTitleView(GetWindowTitle());
+ if (title_view)
+ GetBubbleFrameView()->SetTitleView(title_view);
}
void BubbleDialogDelegateView::OnNativeThemeChanged(

Powered by Google App Engine
This is Rietveld 408576698