Chromium Code Reviews| Index: ui/views/bubble/bubble_delegate.cc |
| diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc |
| index 3987589f3fcb6a66486b20d74f63a5de755ccbd1..da80f3b5b84c95f29163d8a2883f8f54b9f62d77 100644 |
| --- a/ui/views/bubble/bubble_delegate.cc |
| +++ b/ui/views/bubble/bubble_delegate.cc |
| @@ -120,6 +120,7 @@ BubbleDelegateView::BubbleDelegateView() |
| shadow_(BubbleBorder::SMALL_SHADOW), |
| color_explicitly_set_(false), |
| margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), |
| + match_title_margins_(false), |
| original_opacity_(255), |
| border_widget_(NULL), |
| use_focusless_(false), |
| @@ -143,6 +144,7 @@ BubbleDelegateView::BubbleDelegateView( |
| shadow_(BubbleBorder::SMALL_SHADOW), |
| color_explicitly_set_(false), |
| margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), |
| + match_title_margins_(false), |
| original_opacity_(255), |
| border_widget_(NULL), |
| use_focusless_(false), |
| @@ -208,13 +210,23 @@ View* BubbleDelegateView::GetContentsView() { |
| NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
| Widget* widget) { |
| - BubbleFrameView* frame = new BubbleFrameView(margins()); |
| + BubbleFrameView* frame = new BubbleFrameView(match_title_margins_ ? |
|
msw
2013/08/08 18:34:26
Could individual bubbles instead call BubbleDelega
Dan Beam
2013/08/08 21:15:59
Done.
|
| + views::BubbleFrameView::ContentsInsetsToMatchTitle() : margins()); |
| const BubbleBorder::Arrow adjusted_arrow = base::i18n::IsRTL() ? |
| BubbleBorder::horizontal_mirror(arrow()) : arrow(); |
| frame->SetBubbleBorder(new BubbleBorder(adjusted_arrow, shadow(), color())); |
| return frame; |
| } |
| +gfx::Size BubbleDelegateView::GetPreferredSize() { |
| + if (!match_title_margins_) |
| + return WidgetDelegateView::GetPreferredSize(); |
| + |
| + NonClientFrameView* fv = GetWidget()->non_client_view()->frame_view(); |
| + int width = fv->GetBoundsForClientView().width() + GetInsets().width(); |
| + return gfx::Size(width, GetHeightForWidth(width)); |
| +} |
| + |
| void BubbleDelegateView::OnWidgetDestroying(Widget* widget) { |
| if (anchor_widget() == widget) { |
| anchor_widget_->RemoveObserver(this); |