| 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 "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Perform view initialization on the contents for bubble sizing. | 137 // Perform view initialization on the contents for bubble sizing. |
| 138 virtual void Init(); | 138 virtual void Init(); |
| 139 | 139 |
| 140 // Sets the anchor view or rect and repositions the bubble. Note that if a | 140 // Sets the anchor view or rect and repositions the bubble. Note that if a |
| 141 // valid view gets passed, the anchor rect will get ignored. If the view gets | 141 // valid view gets passed, the anchor rect will get ignored. If the view gets |
| 142 // deleted, but no new view gets set, the last known anchor postion will get | 142 // deleted, but no new view gets set, the last known anchor postion will get |
| 143 // returned. | 143 // returned. |
| 144 void SetAnchorView(View* anchor_view); | 144 void SetAnchorView(View* anchor_view); |
| 145 void SetAnchorRect(const gfx::Rect& rect); | 145 void SetAnchorRect(const gfx::Rect& rect); |
| 146 | 146 |
| 147 void set_button_row_insets(const gfx::Insets& insets) { |
| 148 button_row_insets_ = insets; |
| 149 } |
| 150 |
| 147 // Resize and potentially move the bubble to fit the content's preferred size. | 151 // Resize and potentially move the bubble to fit the content's preferred size. |
| 148 void SizeToContents(); | 152 void SizeToContents(); |
| 149 | 153 |
| 150 BubbleFrameView* GetBubbleFrameView() const; | 154 BubbleFrameView* GetBubbleFrameView() const; |
| 151 | 155 |
| 152 private: | 156 private: |
| 153 friend class BubbleBorderDelegate; | 157 friend class BubbleBorderDelegate; |
| 154 friend class BubbleWindowTargeter; | 158 friend class BubbleWindowTargeter; |
| 155 | 159 |
| 156 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); | 160 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 180 // Automatically mirror the arrow in RTL layout. | 184 // Automatically mirror the arrow in RTL layout. |
| 181 bool mirror_arrow_in_rtl_; | 185 bool mirror_arrow_in_rtl_; |
| 182 | 186 |
| 183 // Bubble border shadow to use. | 187 // Bubble border shadow to use. |
| 184 BubbleBorder::Shadow shadow_; | 188 BubbleBorder::Shadow shadow_; |
| 185 | 189 |
| 186 // The background color of the bubble; and flag for when it's explicitly set. | 190 // The background color of the bubble; and flag for when it's explicitly set. |
| 187 SkColor color_; | 191 SkColor color_; |
| 188 bool color_explicitly_set_; | 192 bool color_explicitly_set_; |
| 189 | 193 |
| 190 // The margins between the content and the inside of the border. | 194 // The margins between the content (including buttons) and the inside of the |
| 195 // border. |
| 191 gfx::Insets margins_; | 196 gfx::Insets margins_; |
| 192 | 197 |
| 193 // The margins around the title. | 198 // The margins around the title. |
| 194 // TODO(tapted): Investigate deleting this when MD is default. | 199 // TODO(tapted): Investigate deleting this when MD is default. |
| 195 gfx::Insets title_margins_; | 200 gfx::Insets title_margins_; |
| 196 | 201 |
| 197 // Insets applied to the |anchor_view_| bounds. | 202 // Insets applied to the |anchor_view_| bounds. |
| 198 gfx::Insets anchor_view_insets_; | 203 gfx::Insets anchor_view_insets_; |
| 199 | 204 |
| 205 // Insets around the button row (when buttons are present). Note that bottom |
| 206 // and side insets from |margins_| are already added around the button row. |
| 207 gfx::Insets button_row_insets_; |
| 208 |
| 200 // Specifies whether the bubble (or its border) handles mouse events, etc. | 209 // Specifies whether the bubble (or its border) handles mouse events, etc. |
| 201 bool accept_events_; | 210 bool accept_events_; |
| 202 | 211 |
| 203 // If true (defaults to true), the arrow may be mirrored and moved to fit the | 212 // If true (defaults to true), the arrow may be mirrored and moved to fit the |
| 204 // bubble on screen better. It would be a no-op if the bubble has no arrow. | 213 // bubble on screen better. It would be a no-op if the bubble has no arrow. |
| 205 bool adjust_if_offscreen_; | 214 bool adjust_if_offscreen_; |
| 206 | 215 |
| 207 // Parent native window of the bubble. | 216 // Parent native window of the bubble. |
| 208 gfx::NativeView parent_window_; | 217 gfx::NativeView parent_window_; |
| 209 | 218 |
| 210 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView); | 219 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView); |
| 211 }; | 220 }; |
| 212 | 221 |
| 213 } // namespace views | 222 } // namespace views |
| 214 | 223 |
| 215 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_ | 224 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_ |
| OLD | NEW |