| Index: views/bubble/bubble_delegate.cc
|
| diff --git a/views/bubble/bubble_delegate.cc b/views/bubble/bubble_delegate.cc
|
| index 9f997473d95c7a2efa90dfb7d8e5c4caf7a0d854..1e32069cb04e778d513d6c493d84d7273de9ea14 100644
|
| --- a/views/bubble/bubble_delegate.cc
|
| +++ b/views/bubble/bubble_delegate.cc
|
| @@ -87,7 +87,7 @@ BubbleDelegateView::BubbleDelegateView()
|
| }
|
|
|
| BubbleDelegateView::BubbleDelegateView(
|
| - View* anchor_view,
|
| + const View* anchor_view,
|
| BubbleBorder::ArrowLocation arrow_location,
|
| const SkColor& color)
|
| : close_on_esc_(true),
|
| @@ -111,22 +111,20 @@ BubbleDelegateView::~BubbleDelegateView() {
|
| // static
|
| Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) {
|
| bubble_delegate->Init();
|
| - Widget* parent_widget = bubble_delegate->anchor_view() ?
|
| - bubble_delegate->anchor_view()->GetWidget() : NULL;
|
| - Widget* bubble_widget = CreateBubbleWidget(bubble_delegate, parent_widget);
|
| + Widget* parent = bubble_delegate->anchor_view() ?
|
| + const_cast<Widget*>(bubble_delegate->anchor_view()->GetWidget()) : NULL;
|
| + Widget* bubble_widget = CreateBubbleWidget(bubble_delegate, parent);
|
|
|
| #if defined(OS_WIN) && !defined(USE_AURA)
|
| // First set the contents view to initialize view bounds for widget sizing.
|
| bubble_widget->SetContentsView(bubble_delegate->GetContentsView());
|
| - bubble_delegate->InitializeBorderWidget(parent_widget);
|
| - bubble_widget->SetBounds(bubble_delegate->GetBubbleClientBounds());
|
| -#else
|
| - bubble_widget->SetBounds(bubble_delegate->GetBubbleBounds());
|
| + bubble_delegate->border_widget_ = CreateBorderWidget(bubble_delegate, parent);
|
| #endif
|
|
|
| + bubble_delegate->SizeToContents();
|
| bubble_widget->AddObserver(bubble_delegate);
|
| - if (parent_widget && parent_widget->GetTopLevelWidget())
|
| - parent_widget->GetTopLevelWidget()->DisableInactiveRendering();
|
| + if (parent && parent->GetTopLevelWidget())
|
| + parent->GetTopLevelWidget()->DisableInactiveRendering();
|
| return bubble_widget;
|
| }
|
|
|
| @@ -224,8 +222,6 @@ bool BubbleDelegateView::AcceleratorPressed(const Accelerator& accelerator) {
|
| return true;
|
| }
|
|
|
| -void BubbleDelegateView::Init() {}
|
| -
|
| void BubbleDelegateView::AnimationEnded(const ui::Animation* animation) {
|
| DCHECK_EQ(animation, fade_animation_.get());
|
| bool closed = fade_animation_->GetCurrentValue() == 0;
|
| @@ -256,6 +252,17 @@ void BubbleDelegateView::AnimationProgressed(const ui::Animation* animation) {
|
| SchedulePaint();
|
| }
|
|
|
| +void BubbleDelegateView::Init() {}
|
| +
|
| +void BubbleDelegateView::SizeToContents() {
|
| +#if defined(OS_WIN) && !defined(USE_AURA)
|
| + border_widget_->SetBounds(GetBubbleBounds());
|
| + GetWidget()->SetBounds(GetBubbleClientBounds());
|
| +#else
|
| + GetWidget()->SetBounds(GetBubbleBounds());
|
| +#endif
|
| +}
|
| +
|
| BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const {
|
| const Widget* widget = border_widget_ ? border_widget_ : GetWidget();
|
| return static_cast<BubbleFrameView*>(widget->non_client_view()->frame_view());
|
| @@ -269,11 +276,6 @@ gfx::Rect BubbleDelegateView::GetBubbleBounds() {
|
| }
|
|
|
| #if defined(OS_WIN) && !defined(USE_AURA)
|
| -void BubbleDelegateView::InitializeBorderWidget(Widget* parent_widget) {
|
| - border_widget_ = CreateBorderWidget(this, parent_widget);
|
| - border_widget_->SetBounds(GetBubbleBounds());
|
| -}
|
| -
|
| gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
|
| gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
|
| client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin());
|
|
|