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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (close_on_deactivate() && widget == GetWidget() && !active) | 223 if (close_on_deactivate() && widget == GetWidget() && !active) |
224 GetWidget()->Close(); | 224 GetWidget()->Close(); |
225 } | 225 } |
226 | 226 |
227 void BubbleDelegateView::OnWidgetMoved(Widget* widget) { | 227 void BubbleDelegateView::OnWidgetMoved(Widget* widget) { |
228 if (move_with_anchor() && anchor_widget() == widget) | 228 if (move_with_anchor() && anchor_widget() == widget) |
229 SizeToContents(); | 229 SizeToContents(); |
230 } | 230 } |
231 | 231 |
232 gfx::Rect BubbleDelegateView::GetAnchorRect() { | 232 gfx::Rect BubbleDelegateView::GetAnchorRect() { |
233 return anchor_view() ? anchor_view()->GetBoundsInScreen() : gfx::Rect(); | 233 if (!anchor_view()) |
| 234 return gfx::Rect(); |
| 235 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); |
| 236 anchor_bounds.Inset(anchor_insets_); |
| 237 return anchor_bounds; |
234 } | 238 } |
235 | 239 |
236 void BubbleDelegateView::Show() { | 240 void BubbleDelegateView::Show() { |
237 GetWidget()->Show(); | 241 GetWidget()->Show(); |
238 } | 242 } |
239 | 243 |
240 void BubbleDelegateView::StartFade(bool fade_in) { | 244 void BubbleDelegateView::StartFade(bool fade_in) { |
241 fade_animation_.reset(new ui::SlideAnimation(this)); | 245 fade_animation_.reset(new ui::SlideAnimation(this)); |
242 fade_animation_->SetSlideDuration(kHideFadeDurationMS); | 246 fade_animation_->SetSlideDuration(kHideFadeDurationMS); |
243 fade_animation_->Reset(fade_in ? 0.0 : 1.0); | 247 fade_animation_->Reset(fade_in ? 0.0 : 1.0); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 341 |
338 #if defined(OS_WIN) && !defined(USE_AURA) | 342 #if defined(OS_WIN) && !defined(USE_AURA) |
339 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 343 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
340 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 344 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
341 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); | 345 client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); |
342 return client_bounds; | 346 return client_bounds; |
343 } | 347 } |
344 #endif | 348 #endif |
345 | 349 |
346 } // namespace views | 350 } // namespace views |
OLD | NEW |