diff options
author | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 23:21:52 +0000 |
---|---|---|
committer | alicet@chromium.org <alicet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 23:21:52 +0000 |
commit | 0bfff1df077e9ab9ad9be9bb877a360ea4f2f925 (patch) | |
tree | 629499954ccb6b349f90bcee9fcdf4081de0cade /views | |
parent | dc44a0b461217eab1e90a2ec6baa744cb67a9d27 (diff) | |
download | chromium_src-0bfff1df077e9ab9ad9be9bb877a360ea4f2f925.zip chromium_src-0bfff1df077e9ab9ad9be9bb877a360ea4f2f925.tar.gz chromium_src-0bfff1df077e9ab9ad9be9bb877a360ea4f2f925.tar.bz2 |
aura: brightness and volume bubble.
BUG=98322
TEST=None
Review URL: http://codereview.chromium.org/8319008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/bubble/bubble_delegate.cc | 12 | ||||
-rw-r--r-- | views/bubble/bubble_delegate.h | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/views/bubble/bubble_delegate.cc b/views/bubble/bubble_delegate.cc index b46e353..1fb7ebf 100644 --- a/views/bubble/bubble_delegate.cc +++ b/views/bubble/bubble_delegate.cc @@ -29,7 +29,8 @@ BubbleDelegateView::BubbleDelegateView( close_on_esc_(true), anchor_point_(anchor_point), arrow_location_(arrow_location), - color_(color) { + color_(color), + original_opacity_(255) { AddAccelerator(Accelerator(ui::VKEY_ESCAPE, 0)); } @@ -88,14 +89,21 @@ void BubbleDelegateView::StartFade(bool fade_in) { fade_animation_->SetSlideDuration(kHideFadeDurationMS); fade_animation_->Reset(fade_in ? 0.0 : 1.0); if (fade_in) { - GetWidget()->SetOpacity(0); + original_opacity_ = 0; + GetWidget()->SetOpacity(original_opacity_); GetWidget()->Show(); fade_animation_->Show(); } else { + original_opacity_ = 255; fade_animation_->Hide(); } } +void BubbleDelegateView::ResetFade() { + fade_animation_.reset(); + GetWidget()->SetOpacity(original_opacity_); +} + bool BubbleDelegateView::AcceleratorPressed(const Accelerator& accelerator) { if (!close_on_esc() || accelerator.key_code() != ui::VKEY_ESCAPE) return false; diff --git a/views/bubble/bubble_delegate.h b/views/bubble/bubble_delegate.h index 8bd0322..929f619 100644 --- a/views/bubble/bubble_delegate.h +++ b/views/bubble/bubble_delegate.h @@ -58,6 +58,10 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. void StartFade(bool fade_in); + // Reset fade and opacity of bubble. Restore the opacity of the + // bubble to the setting before StartFade() was called. + void ResetFade(); + protected: // View overrides: virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; @@ -90,6 +94,9 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // The background color of the bubble. SkColor color_; + + // Original opacity of the bubble. + int original_opacity_; }; } // namespace views |