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 if (!anchor_view()) | 234 gfx::Rect anchor_bounds = anchor_view()? anchor_view()->GetBoundsInScreen() : |
msw
2013/03/14 20:17:58
nit: space before '?'
varunjain
2013/03/14 20:54:59
Done.
| |
235 return gfx::Rect(anchor_point_, gfx::Size()); | 235 gfx::Rect(anchor_point_, gfx::Size()); |
236 gfx::Rect anchor_bounds = anchor_view()->GetBoundsInScreen(); | |
237 anchor_bounds.Inset(anchor_insets_); | 236 anchor_bounds.Inset(anchor_insets_); |
238 return anchor_bounds; | 237 return anchor_bounds; |
239 } | 238 } |
240 | 239 |
241 void BubbleDelegateView::Show() { | 240 void BubbleDelegateView::Show() { |
242 GetWidget()->Show(); | 241 GetWidget()->Show(); |
243 } | 242 } |
244 | 243 |
245 void BubbleDelegateView::StartFade(bool fade_in) { | 244 void BubbleDelegateView::StartFade(bool fade_in) { |
246 fade_animation_.reset(new ui::SlideAnimation(this)); | 245 fade_animation_.reset(new ui::SlideAnimation(this)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 #if defined(OS_WIN) && !defined(USE_AURA) | 357 #if defined(OS_WIN) && !defined(USE_AURA) |
359 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 358 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
360 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 359 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
361 client_bounds.Offset( | 360 client_bounds.Offset( |
362 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 361 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
363 return client_bounds; | 362 return client_bounds; |
364 } | 363 } |
365 #endif | 364 #endif |
366 | 365 |
367 } // namespace views | 366 } // namespace views |
OLD | NEW |