OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ |
6 #define UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 const char* GetClassName() const override; | 50 const char* GetClassName() const override; |
51 | 51 |
52 // WidgetObserver overrides: | 52 // WidgetObserver overrides: |
53 void OnWidgetDestroying(Widget* widget) override; | 53 void OnWidgetDestroying(Widget* widget) override; |
54 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override; | 54 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override; |
55 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override; | 55 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override; |
56 void OnWidgetActivationChanged(Widget* widget, bool active) override; | 56 void OnWidgetActivationChanged(Widget* widget, bool active) override; |
57 void OnWidgetBoundsChanged(Widget* widget, | 57 void OnWidgetBoundsChanged(Widget* widget, |
58 const gfx::Rect& new_bounds) override; | 58 const gfx::Rect& new_bounds) override; |
59 | 59 |
60 // View: | |
61 void AddedToWidget() override; | |
sky
2017/06/09 23:49:16
Move up to WidgetDelegateView section above.
Bret
2017/06/15 22:20:34
Done.
| |
62 | |
60 bool close_on_deactivate() const { return close_on_deactivate_; } | 63 bool close_on_deactivate() const { return close_on_deactivate_; } |
61 void set_close_on_deactivate(bool close) { close_on_deactivate_ = close; } | 64 void set_close_on_deactivate(bool close) { close_on_deactivate_ = close; } |
62 | 65 |
63 View* GetAnchorView() const; | 66 View* GetAnchorView() const; |
64 Widget* anchor_widget() const { return anchor_widget_; } | 67 Widget* anchor_widget() const { return anchor_widget_; } |
65 | 68 |
66 // The anchor rect is used in the absence of an assigned anchor view. | 69 // The anchor rect is used in the absence of an assigned anchor view. |
67 const gfx::Rect& anchor_rect() const { return anchor_rect_; } | 70 const gfx::Rect& anchor_rect() const { return anchor_rect_; } |
68 | 71 |
69 BubbleBorder::Arrow arrow() const { return arrow_; } | 72 BubbleBorder::Arrow arrow() const { return arrow_; } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 void SetArrowPaintType(BubbleBorder::ArrowPaintType paint_type); | 119 void SetArrowPaintType(BubbleBorder::ArrowPaintType paint_type); |
117 | 120 |
118 // Sets the bubble border interior thickness. | 121 // Sets the bubble border interior thickness. |
119 void SetBorderInteriorThickness(int thickness); | 122 void SetBorderInteriorThickness(int thickness); |
120 | 123 |
121 // Call this method when the anchor bounds have changed to reposition the | 124 // Call this method when the anchor bounds have changed to reposition the |
122 // bubble. The bubble is automatically repositioned when the anchor view | 125 // bubble. The bubble is automatically repositioned when the anchor view |
123 // bounds change as a result of the widget's bounds changing. | 126 // bounds change as a result of the widget's bounds changing. |
124 void OnAnchorBoundsChanged(); | 127 void OnAnchorBoundsChanged(); |
125 | 128 |
129 // Called when the title of the dialog needs to be updated. | |
130 void PropagateUpdateTitleView(View* title_view); | |
131 | |
126 protected: | 132 protected: |
127 BubbleDialogDelegateView(); | 133 BubbleDialogDelegateView(); |
128 BubbleDialogDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); | 134 BubbleDialogDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); |
129 | 135 |
130 // Get bubble bounds from the anchor rect and client view's preferred size. | 136 // Get bubble bounds from the anchor rect and client view's preferred size. |
131 virtual gfx::Rect GetBubbleBounds(); | 137 virtual gfx::Rect GetBubbleBounds(); |
132 | 138 |
133 // Return a FontList to use for the title of the bubble. | 139 // Return a FontList to use for the title of the bubble. |
134 // (The default is MediumFont). | 140 // (The default is MediumFont). |
135 virtual const gfx::FontList& GetTitleFontList() const; | 141 virtual const gfx::FontList& GetTitleFontList() const; |
136 | 142 |
143 // Returns a custom view to use as the title of the dialog. | |
144 virtual View* CreateTitleView(); | |
145 | |
146 // Called when the title of the dialog needs to be updated and a custom title | |
147 // view is being used. | |
148 virtual void UpdateTitleView(View* view, | |
149 base::string16 title_text, | |
150 bool visible) {} | |
151 | |
137 // View overrides: | 152 // View overrides: |
138 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 153 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
139 | 154 |
140 // Perform view initialization on the contents for bubble sizing. | 155 // Perform view initialization on the contents for bubble sizing. |
141 virtual void Init(); | 156 virtual void Init(); |
142 | 157 |
143 // Sets the anchor view or rect and repositions the bubble. Note that if a | 158 // Sets the anchor view or rect and repositions the bubble. Note that if a |
144 // valid view gets passed, the anchor rect will get ignored. If the view gets | 159 // valid view gets passed, the anchor rect will get ignored. If the view gets |
145 // deleted, but no new view gets set, the last known anchor postion will get | 160 // deleted, but no new view gets set, the last known anchor postion will get |
146 // returned. | 161 // returned. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 224 |
210 // Parent native window of the bubble. | 225 // Parent native window of the bubble. |
211 gfx::NativeView parent_window_; | 226 gfx::NativeView parent_window_; |
212 | 227 |
213 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView); | 228 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView); |
214 }; | 229 }; |
215 | 230 |
216 } // namespace views | 231 } // namespace views |
217 | 232 |
218 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_ | 233 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_ |
OLD | NEW |