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 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); |
236 anchor_bounds.Inset(anchor_insets_); | 236 anchor_bounds.Inset(anchor_insets_); |
237 return anchor_bounds; | 237 return anchor_bounds; |
238 } else { | |
239 return gfx::Rect(anchor_point_, gfx::Size()); | |
benwells
2013/03/28 05:43:18
nit: no need for the else here, as the if() has a
| |
240 } | |
238 } | 241 } |
239 | 242 |
240 void BubbleDelegateView::StartFade(bool fade_in) { | 243 void BubbleDelegateView::StartFade(bool fade_in) { |
241 fade_animation_.reset(new ui::SlideAnimation(this)); | 244 fade_animation_.reset(new ui::SlideAnimation(this)); |
242 fade_animation_->SetSlideDuration(kHideFadeDurationMS); | 245 fade_animation_->SetSlideDuration(kHideFadeDurationMS); |
243 fade_animation_->Reset(fade_in ? 0.0 : 1.0); | 246 fade_animation_->Reset(fade_in ? 0.0 : 1.0); |
244 if (fade_in) { | 247 if (fade_in) { |
245 original_opacity_ = 0; | 248 original_opacity_ = 0; |
246 if (border_widget_) | 249 if (border_widget_) |
247 border_widget_->SetOpacity(original_opacity_); | 250 border_widget_->SetOpacity(original_opacity_); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 #if defined(OS_WIN) && !defined(USE_AURA) | 356 #if defined(OS_WIN) && !defined(USE_AURA) |
354 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 357 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
355 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 358 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
356 client_bounds.Offset( | 359 client_bounds.Offset( |
357 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 360 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
358 return client_bounds; | 361 return client_bounds; |
359 } | 362 } |
360 #endif | 363 #endif |
361 | 364 |
362 } // namespace views | 365 } // namespace views |
OLD | NEW |