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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 gfx::Rect anchor_bounds = anchor_view() ? anchor_view()->GetBoundsInScreen() : |
235 gfx::Rect(anchor_point_, gfx::Size()); | 235 gfx::Rect(anchor_point_, gfx::Size()); |
236 anchor_bounds.Inset(anchor_insets_); | 236 anchor_bounds.Inset(anchor_insets_); |
237 return anchor_bounds; | 237 return anchor_bounds; |
238 } | 238 } |
239 | 239 |
240 void BubbleDelegateView::Show() { | |
241 GetWidget()->Show(); | |
242 } | |
243 | |
244 void BubbleDelegateView::StartFade(bool fade_in) { | 240 void BubbleDelegateView::StartFade(bool fade_in) { |
245 fade_animation_.reset(new ui::SlideAnimation(this)); | 241 fade_animation_.reset(new ui::SlideAnimation(this)); |
246 fade_animation_->SetSlideDuration(kHideFadeDurationMS); | 242 fade_animation_->SetSlideDuration(kHideFadeDurationMS); |
247 fade_animation_->Reset(fade_in ? 0.0 : 1.0); | 243 fade_animation_->Reset(fade_in ? 0.0 : 1.0); |
248 if (fade_in) { | 244 if (fade_in) { |
249 original_opacity_ = 0; | 245 original_opacity_ = 0; |
250 if (border_widget_) | 246 if (border_widget_) |
251 border_widget_->SetOpacity(original_opacity_); | 247 border_widget_->SetOpacity(original_opacity_); |
252 GetWidget()->SetOpacity(original_opacity_); | 248 GetWidget()->SetOpacity(original_opacity_); |
253 Show(); | 249 GetWidget()->Show(); |
254 fade_animation_->Show(); | 250 fade_animation_->Show(); |
255 } else { | 251 } else { |
256 original_opacity_ = 255; | 252 original_opacity_ = 255; |
257 fade_animation_->Hide(); | 253 fade_animation_->Hide(); |
258 } | 254 } |
259 } | 255 } |
260 | 256 |
261 void BubbleDelegateView::ResetFade() { | 257 void BubbleDelegateView::ResetFade() { |
262 fade_animation_.reset(); | 258 fade_animation_.reset(); |
263 if (border_widget_) | 259 if (border_widget_) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 #if defined(OS_WIN) && !defined(USE_AURA) | 353 #if defined(OS_WIN) && !defined(USE_AURA) |
358 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 354 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
359 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 355 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
360 client_bounds.Offset( | 356 client_bounds.Offset( |
361 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 357 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
362 return client_bounds; | 358 return client_bounds; |
363 } | 359 } |
364 #endif | 360 #endif |
365 | 361 |
366 } // namespace views | 362 } // namespace views |
OLD | NEW |