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..9cae8620c916609e8f97f5001af826f4a6e402cf 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,10 @@ 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. The title view is owned by this BubbleFrameView. If there is an |
+ // existing title view it will be deleted. |
+ void SetTitleView(View* title_view); |
sky
2017/06/22 14:48:48
Please add test coverage of this. Maybe that setti
Bret
2017/06/22 22:18:30
See the change in bubble_dialog_delegate_unittest.
|
// View: |
const char* GetClassName() const override; |
@@ -101,6 +102,14 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons); |
FRIEND_TEST_ALL_PREFIXES(BubbleDialogDelegateTest, CloseMethods); |
+ const View* title() const { |
+ return delegate_title_ ? delegate_title_ : default_title_; |
+ } |
+ View* title() { |
+ return const_cast<View*>( |
+ static_cast<const BubbleFrameView*>(this)->title()); |
sky
2017/06/22 14:48:48
static_cast -> const_cast
Peter Kasting
2017/06/22 17:49:34
The Meyers pattern is to use static_cast here, whi
|
+ } |
+ |
// Mirrors the bubble's arrow location on the |vertical| or horizontal axis, |
// if the generated window bounds don't fit in the monitor bounds. |
void MirrorArrowIfOffScreen(bool vertical, |
@@ -126,7 +135,8 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
// The optional title icon, title, and (x) close button. |
views::ImageView* title_icon_; |
- Label* title_; |
+ Label* default_title_; |
sky
2017/06/22 14:48:48
It's quite subtle why there are two titles. Please
Bret
2017/06/22 22:18:30
Done.
|
+ View* delegate_title_; |
sky
2017/06/22 14:48:48
Why did you go with 'delegate' as the prefix for t
Bret
2017/06/22 22:18:30
It was more associated with the delegate in the ea
|
Button* close_; |
// A view to contain the footnote view, if it exists. |