Chromium Code Reviews| Index: ui/views/bubble/bubble_frame_view.h |
| diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h |
| index 4f4d94647a9d20d963fecd7794bb06b640751441..015cc5face10d57842a91c80dcedff7a5072d61b 100644 |
| --- a/ui/views/bubble/bubble_frame_view.h |
| +++ b/ui/views/bubble/bubble_frame_view.h |
| @@ -8,17 +8,14 @@ |
| #include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| +#include "ui/gfx/font_list.h" |
| #include "ui/gfx/geometry/insets.h" |
| #include "ui/views/controls/button/button.h" |
| +#include "ui/views/controls/label.h" |
| #include "ui/views/window/non_client_view.h" |
| -namespace gfx { |
| -class FontList; |
| -} |
| - |
| namespace views { |
| -class Label; |
| class BubbleBorder; |
| class ImageView; |
| @@ -33,6 +30,9 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
| const gfx::Insets& content_margins); |
| ~BubbleFrameView() override; |
| + static std::unique_ptr<Label> CreateDefaultTitleLabel( |
| + const base::string16& title_text); |
| + |
| // Creates a close button used in the corner of the dialog. |
| static Button* CreateCloseButton(ButtonListener* listener); |
| @@ -48,9 +48,9 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
| void UpdateWindowTitle() override; |
| void SizeConstraintsChanged() override; |
| - // Set the FontList to be used for the title of the bubble. |
| - // Caller must arrange to update the layout to have the call take effect. |
| - void SetTitleFontList(const gfx::FontList& font_list); |
| + // Sets a custom view to be the dialog title instead of the |default_title_| |
| + // label. If there is an existing title view it will be deleted. |
| + void SetTitleView(std::unique_ptr<View> title_view); |
| // View: |
| const char* GetClassName() const override; |
| @@ -73,6 +73,14 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
| BubbleBorder* bubble_border() const { return bubble_border_; } |
| void SetBubbleBorder(std::unique_ptr<BubbleBorder> border); |
| + const View* title() const { |
| + return custom_title_ ? custom_title_ : default_title_; |
| + } |
| + View* title() { |
| + return const_cast<View*>( |
| + static_cast<const BubbleFrameView*>(this)->title()); |
|
Peter Kasting
2017/06/27 01:13:18
Nit: I kinda wonder whether just duplicating the c
Bret
2017/06/27 23:21:42
I would if it were a totally trivial getter, but I
|
| + } |
| + |
| gfx::Insets content_margins() const { return content_margins_; } |
| void SetFootnoteView(View* view); |
| @@ -124,9 +132,16 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
| // Margins between the content and the inside of the border, in pixels. |
| gfx::Insets content_margins_; |
| - // The optional title icon, title, and (x) close button. |
| + // The optional title icon. |
| views::ImageView* title_icon_; |
| - Label* title_; |
| + |
| + // One of these fields is used as the dialog title. If SetTitleView is called |
| + // the custom title view is stored in |custom_title_| and this class assumes |
| + // ownership. Otherwise |default_title_| is used. |
| + Label* default_title_; |
| + View* custom_title_; |
| + |
| + // The optional close button (the X). |
| Button* close_; |
| // A view to contain the footnote view, if it exists. |