OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/views/bubble/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/base/animation/slide_animation.h" | 7 #include "ui/base/animation/slide_animation.h" |
8 #include "ui/gfx/color_utils.h" | 8 #include "ui/gfx/color_utils.h" |
9 #include "ui/views/bubble/bubble_frame_view.h" | 9 #include "ui/views/bubble/bubble_frame_view.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 if (close_on_deactivate() && widget == GetWidget() && !active) | 226 if (close_on_deactivate() && widget == GetWidget() && !active) |
227 GetWidget()->Close(); | 227 GetWidget()->Close(); |
228 } | 228 } |
229 | 229 |
230 void BubbleDelegateView::OnWidgetMoved(Widget* widget) { | 230 void BubbleDelegateView::OnWidgetMoved(Widget* widget) { |
231 if (move_with_anchor() && anchor_widget() == widget) | 231 if (move_with_anchor() && anchor_widget() == widget) |
232 SizeToContents(); | 232 SizeToContents(); |
233 } | 233 } |
234 | 234 |
235 gfx::Rect BubbleDelegateView::GetAnchorRect() { | 235 gfx::Rect BubbleDelegateView::GetAnchorRect() { |
236 return anchor_view() ? anchor_view()->GetScreenBounds() : gfx::Rect(); | 236 return anchor_view() ? anchor_view()->GetBoundsInScreen() : gfx::Rect(); |
237 } | 237 } |
238 | 238 |
239 void BubbleDelegateView::Show() { | 239 void BubbleDelegateView::Show() { |
240 GetWidget()->Show(); | 240 GetWidget()->Show(); |
241 } | 241 } |
242 | 242 |
243 void BubbleDelegateView::StartFade(bool fade_in) { | 243 void BubbleDelegateView::StartFade(bool fade_in) { |
244 fade_animation_.reset(new ui::SlideAnimation(this)); | 244 fade_animation_.reset(new ui::SlideAnimation(this)); |
245 fade_animation_->SetSlideDuration(kHideFadeDurationMS); | 245 fade_animation_->SetSlideDuration(kHideFadeDurationMS); |
246 fade_animation_->Reset(fade_in ? 0.0 : 1.0); | 246 fade_animation_->Reset(fade_in ? 0.0 : 1.0); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 gfx::Rect BubbleDelegateView::GetBubbleBounds() { | 334 gfx::Rect BubbleDelegateView::GetBubbleBounds() { |
335 // The argument rect has its origin at the bubble's arrow anchor point; | 335 // The argument rect has its origin at the bubble's arrow anchor point; |
336 // its size is the preferred size of the bubble's client view (this view). | 336 // its size is the preferred size of the bubble's client view (this view). |
337 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), | 337 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), |
338 GetPreferredSize(), true /*try_mirroring_arrow*/); | 338 GetPreferredSize(), true /*try_mirroring_arrow*/); |
339 } | 339 } |
340 | 340 |
341 #if defined(OS_WIN) && !defined(USE_AURA) | 341 #if defined(OS_WIN) && !defined(USE_AURA) |
342 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 342 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
343 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 343 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
344 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); | 344 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); |
345 return client_bounds; | 345 return client_bounds; |
346 } | 346 } |
347 #endif | 347 #endif |
348 | 348 |
349 } // namespace views | 349 } // namespace views |
OLD | NEW |