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/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 GetWidget()->Close(); | 224 GetWidget()->Close(); |
225 } | 225 } |
226 | 226 |
227 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, | 227 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, |
228 const gfx::Rect& new_bounds) { | 228 const gfx::Rect& new_bounds) { |
229 if (move_with_anchor() && anchor_widget() == widget) | 229 if (move_with_anchor() && anchor_widget() == widget) |
230 SizeToContents(); | 230 SizeToContents(); |
231 } | 231 } |
232 | 232 |
233 gfx::Rect BubbleDelegateView::GetAnchorRect() { | 233 gfx::Rect BubbleDelegateView::GetAnchorRect() { |
234 gfx::Rect anchor_bounds = anchor_view() ? anchor_view()->GetBoundsInScreen() : | 234 if (!anchor_view()) |
235 gfx::Rect(anchor_point_, gfx::Size()); | 235 return anchor_rect_; |
236 anchor_bounds.Inset(anchor_insets_); | 236 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); |
| 237 anchor_bounds.Inset(anchor_view_insets_); |
237 return anchor_bounds; | 238 return anchor_bounds; |
238 } | 239 } |
239 | 240 |
240 void BubbleDelegateView::StartFade(bool fade_in) { | 241 void BubbleDelegateView::StartFade(bool fade_in) { |
241 fade_animation_.reset(new ui::SlideAnimation(this)); | 242 fade_animation_.reset(new ui::SlideAnimation(this)); |
242 fade_animation_->SetSlideDuration(kHideFadeDurationMS); | 243 fade_animation_->SetSlideDuration(kHideFadeDurationMS); |
243 fade_animation_->Reset(fade_in ? 0.0 : 1.0); | 244 fade_animation_->Reset(fade_in ? 0.0 : 1.0); |
244 if (fade_in) { | 245 if (fade_in) { |
245 original_opacity_ = 0; | 246 original_opacity_ = 0; |
246 if (border_widget_) | 247 if (border_widget_) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 #if defined(OS_WIN) && !defined(USE_AURA) | 354 #if defined(OS_WIN) && !defined(USE_AURA) |
354 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 355 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
355 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 356 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
356 client_bounds.Offset( | 357 client_bounds.Offset( |
357 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 358 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
358 return client_bounds; | 359 return client_bounds; |
359 } | 360 } |
360 #endif | 361 #endif |
361 | 362 |
362 } // namespace views | 363 } // namespace views |
OLD | NEW |