diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 19:20:35 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 19:20:35 +0000 |
commit | 64d7e590196201394f7c82ece32c550a7c26495c (patch) | |
tree | 45098b5b47497572febfd550edab05a3384aab7b | |
parent | 06c351aba2a01ade8b5681c1f8c548eaf50c1a02 (diff) | |
download | chromium_src-64d7e590196201394f7c82ece32c550a7c26495c.zip chromium_src-64d7e590196201394f7c82ece32c550a7c26495c.tar.gz chromium_src-64d7e590196201394f7c82ece32c550a7c26495c.tar.bz2 |
chromeos: Refactor volume bubble for other settings.
This adds a new SettingLevelBubble class (nothing new here;
it's just the previous implementation of VolumeBubble but
with a configurable icon) and makes VolumeBubble implement
it. I'll add a BrightnessBubble class in a later changelist,
along with code to hide the other bubble when we start
showing one.
BUG=chromium-os:4816
TEST=built it and checked that the volume bubble behaves the same as before when pressing F8, F9, and F10
Review URL: http://codereview.chromium.org/3766001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68195 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/setting_level_bubble.cc | 132 | ||||
-rw-r--r-- | chrome/browser/chromeos/setting_level_bubble.h | 65 | ||||
-rw-r--r-- | chrome/browser/chromeos/setting_level_bubble_view.cc | 64 | ||||
-rw-r--r-- | chrome/browser/chromeos/setting_level_bubble_view.h | 47 | ||||
-rw-r--r-- | chrome/browser/chromeos/system_key_event_listener.cc | 20 | ||||
-rw-r--r-- | chrome/browser/chromeos/volume_bubble.cc | 127 | ||||
-rw-r--r-- | chrome/browser/chromeos/volume_bubble.h | 39 | ||||
-rw-r--r-- | chrome/browser/chromeos/volume_bubble_view.cc | 66 | ||||
-rw-r--r-- | chrome/browser/chromeos/volume_bubble_view.h | 43 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 6 |
10 files changed, 331 insertions, 278 deletions
diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc new file mode 100644 index 0000000..1847413 --- /dev/null +++ b/chrome/browser/chromeos/setting_level_bubble.cc @@ -0,0 +1,132 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/setting_level_bubble.h" + +#include <gdk/gdk.h> + +#include "base/timer.h" +#include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_window.h" +#include "chrome/browser/chromeos/setting_level_bubble_view.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/views/info_bubble.h" +#include "views/widget/root_view.h" + +namespace { + +const int kBubbleShowTimeoutSec = 2; +const int kAnimationDurationMs = 200; + +// Horizontal relative position: 0 - leftmost, 0.5 - center, 1 - rightmost. +const double kBubbleXRatio = 0.5; + +// Vertical gap from the bottom of the screen in pixels. +const int kBubbleBottomGap = 30; + +} // namespace + +namespace chromeos { + +// Temporary helper routine. Returns the widget from the most-recently-focused +// normal browser window or NULL. +// TODO(glotov): remove this in favor of enabling InfoBubble class act +// without |parent| specified. crosbug.com/4025 +static views::Widget* GetToplevelWidget() { + // We just use the default profile here -- this gets overridden as needed + // in Chrome OS depending on whether the user is logged in or not. + Browser* browser = + BrowserList::FindBrowserWithType( + ProfileManager::GetDefaultProfile(), + Browser::TYPE_NORMAL, + true); // match_incognito + if (!browser) + return NULL; + + views::RootView* root = + views::Widget::FindRootView( + GTK_WINDOW(browser->window()->GetNativeHandle())); + DCHECK(root); + if (!root) + return NULL; + + return root->GetWidget(); +} + +SettingLevelBubble::SettingLevelBubble(SkBitmap* icon) + : previous_percent_(-1), + current_percent_(-1), + icon_(icon), + bubble_(NULL), + view_(NULL), + animation_(this) { + animation_.SetSlideDuration(kAnimationDurationMs); + animation_.SetTweenType(Tween::LINEAR); +} + +void SettingLevelBubble::ShowBubble(int percent) { + if (percent < 0) + percent = 0; + if (percent > 100) + percent = 100; + if (previous_percent_ == -1) + previous_percent_ = percent; + current_percent_ = percent; + if (!bubble_) { + views::Widget* widget = GetToplevelWidget(); + if (widget == NULL) + return; + DCHECK(view_ == NULL); + view_ = new SettingLevelBubbleView; + view_->Init(icon_, previous_percent_); + // Calculate position of the bubble. + gfx::Rect bounds; + widget->GetBounds(&bounds, false); + const gfx::Size view_size = view_->GetPreferredSize(); + // Note that (x, y) is the point of the center of the bubble. + const int x = view_size.width() / 2 + + kBubbleXRatio * (bounds.width() - view_size.width()); + const int y = bounds.height() - view_size.height() / 2 - kBubbleBottomGap; + bubble_ = InfoBubble::ShowFocusless(widget, gfx::Rect(x, y, 0, 20), + BubbleBorder::FLOAT, view_, this); + } else { + DCHECK(view_); + timeout_timer_.Stop(); + } + if (animation_.is_animating()) + animation_.End(); + animation_.Reset(); + animation_.Show(); + timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), + this, &SettingLevelBubble::OnTimeout); +} + +void SettingLevelBubble::OnTimeout() { + if (bubble_) + bubble_->Close(); +} + +void SettingLevelBubble::InfoBubbleClosing(InfoBubble* info_bubble, bool) { + DCHECK(info_bubble == bubble_); + timeout_timer_.Stop(); + animation_.Stop(); + bubble_ = NULL; + view_ = NULL; +} + +void SettingLevelBubble::AnimationEnded(const Animation* animation) { + previous_percent_ = current_percent_; +} + +void SettingLevelBubble::AnimationProgressed(const Animation* animation) { + if (view_) { + view_->Update( + Tween::ValueBetween(animation->GetCurrentValue(), + previous_percent_, + current_percent_)); + } +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h new file mode 100644 index 0000000..2d36a87 --- /dev/null +++ b/chrome/browser/chromeos/setting_level_bubble.h @@ -0,0 +1,65 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ +#define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ +#pragma once + +#include "app/animation_delegate.h" +#include "app/slide_animation.h" +#include "base/timer.h" +#include "chrome/browser/views/info_bubble.h" + +class SkBitmap; + +namespace chromeos { + +class SettingLevelBubbleView; + +// Singleton class controlling a bubble displaying a level-based setting like +// volume or brightness. +class SettingLevelBubble : public InfoBubbleDelegate, + public AnimationDelegate { + public: + void ShowBubble(int percent); + + protected: + explicit SettingLevelBubble(SkBitmap* icon); + virtual ~SettingLevelBubble() {} + + private: + void OnTimeout(); + + // Overridden from InfoBubbleDelegate. + virtual void InfoBubbleClosing(InfoBubble* info_bubble, + bool closed_by_escape); + virtual bool CloseOnEscape() { return true; } + virtual bool FadeInOnShow() { return false; } + + // Overridden from AnimationDelegate. + virtual void AnimationEnded(const Animation* animation); + virtual void AnimationProgressed(const Animation* animation); + + // Previous and current percentages, or -1 if not yet shown. + int previous_percent_; + int current_percent_; + + // Icon displayed in the bubble. Not owned by us. + SkBitmap* icon_; + + // Currently shown bubble or NULL. + InfoBubble* bubble_; + + // Its contents view, owned by InfoBubble. + SettingLevelBubbleView* view_; + + SlideAnimation animation_; + base::OneShotTimer<SettingLevelBubble> timeout_timer_; + + DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ diff --git a/chrome/browser/chromeos/setting_level_bubble_view.cc b/chrome/browser/chromeos/setting_level_bubble_view.cc new file mode 100644 index 0000000..6a1f992 --- /dev/null +++ b/chrome/browser/chromeos/setting_level_bubble_view.cc @@ -0,0 +1,64 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/setting_level_bubble_view.h" + +#include <string> + +#include "base/logging.h" +#include "gfx/canvas.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "views/controls/progress_bar.h" + +using views::Background; +using views::View; +using views::Widget; + +namespace { + +// Bubble metrics. +const int kWidth = 300, kHeight = 75; +const int kMargin = 25; +const int kProgressBarHeight = 20; + +} // namespace + +namespace chromeos { + +SettingLevelBubbleView::SettingLevelBubbleView() + : progress_bar_(NULL), + icon_(NULL) { +} + +void SettingLevelBubbleView::Init(SkBitmap* icon, int level_percent) { + DCHECK(level_percent >= 0 && level_percent <= 100); + icon_ = icon; + progress_bar_ = new views::ProgressBar(); + AddChildView(progress_bar_); + Update(level_percent); +} + +void SettingLevelBubbleView::Update(int level_percent) { + DCHECK(level_percent >= 0 && level_percent <= 100); + progress_bar_->SetProgress(level_percent); +} + +void SettingLevelBubbleView::Paint(gfx::Canvas* canvas) { + views::View::Paint(canvas); + canvas->DrawBitmapInt(*icon_, + icon_->width(), (height() - icon_->height()) / 2); +} + +void SettingLevelBubbleView::Layout() { + progress_bar_->SetBounds(icon_->width() + kMargin * 2, + (height() - kProgressBarHeight) / 2, + width() - icon_->width() - kMargin * 3, + kProgressBarHeight); +} + +gfx::Size SettingLevelBubbleView::GetPreferredSize() { + return gfx::Size(kWidth, kHeight); +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/setting_level_bubble_view.h b/chrome/browser/chromeos/setting_level_bubble_view.h new file mode 100644 index 0000000..b1c43ec --- /dev/null +++ b/chrome/browser/chromeos/setting_level_bubble_view.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ +#pragma once + +#include "views/view.h" + +namespace views { +class ProgressBar; +} // namespace views + +class SkBitmap; + +namespace chromeos { + +// SettingLevelBubbleView displays information about the current value of a +// level-based setting like volume or brightness. +class SettingLevelBubbleView : public views::View { + public: + SettingLevelBubbleView(); + + // Initialize the view, setting the progress bar to the specified position. + // Ownership of |icon| remains with the caller (it's probably a shared + // instance from ResourceBundle). + void Init(SkBitmap* icon, int level_percent); + + // Set the progress bar to the specified position and redraw it. + void Update(int level_percent); + + // views::View implementation: + virtual void Paint(gfx::Canvas* canvas); + virtual void Layout(); + virtual gfx::Size GetPreferredSize(); + + private: + views::ProgressBar* progress_bar_; + SkBitmap* icon_; // not owned + + DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ diff --git a/chrome/browser/chromeos/system_key_event_listener.cc b/chrome/browser/chromeos/system_key_event_listener.cc index 74af308..0ac003a 100644 --- a/chrome/browser/chromeos/system_key_event_listener.cc +++ b/chrome/browser/chromeos/system_key_event_listener.cc @@ -118,27 +118,27 @@ void SystemKeyEventListener::GrabKey(int32 key, uint32 mask) { True, GrabModeAsync, GrabModeAsync); } -// TODO(davej): Move the ShowVolumeBubble() calls in to AudioHandler so that -// this function returns faster without blocking on GetVolumePercent(), and -// still guarantees that the volume displayed will be that after the adjustment. +// TODO(davej): Move the ShowBubble() calls in to AudioHandler so that this +// function returns faster without blocking on GetVolumePercent(), and still +// guarantees that the volume displayed will be that after the adjustment. -// TODO(davej): The IsMute() check can also be made non-blocking by changing -// to an AdjustVolumeByPercentOrUnmute() function which can do the steps off -// of this thread when ShowVolumeBubble() is moved in to AudioHandler. +// TODO(davej): The IsMute() check can also be made non-blocking by changing to +// an AdjustVolumeByPercentOrUnmute() function which can do the steps off of +// this thread when ShowBubble() is moved in to AudioHandler. void SystemKeyEventListener::OnVolumeMute() { // Always muting (and not toggling) as per final decision on // http://crosbug.com/3751 audio_handler_->SetMute(true); - VolumeBubble::instance()->ShowVolumeBubble(0); + VolumeBubble::instance()->ShowBubble(0); } void SystemKeyEventListener::OnVolumeDown() { if (audio_handler_->IsMute()) { - VolumeBubble::instance()->ShowVolumeBubble(0); + VolumeBubble::instance()->ShowBubble(0); } else { audio_handler_->AdjustVolumeByPercent(-kStepPercentage); - VolumeBubble::instance()->ShowVolumeBubble( + VolumeBubble::instance()->ShowBubble( audio_handler_->GetVolumePercent()); } } @@ -148,7 +148,7 @@ void SystemKeyEventListener::OnVolumeUp() { audio_handler_->SetMute(false); else audio_handler_->AdjustVolumeByPercent(kStepPercentage); - VolumeBubble::instance()->ShowVolumeBubble( + VolumeBubble::instance()->ShowBubble( audio_handler_->GetVolumePercent()); } diff --git a/chrome/browser/chromeos/volume_bubble.cc b/chrome/browser/chromeos/volume_bubble.cc index 052a959..b10acb3 100644 --- a/chrome/browser/chromeos/volume_bubble.cc +++ b/chrome/browser/chromeos/volume_bubble.cc @@ -4,132 +4,15 @@ #include "chrome/browser/chromeos/volume_bubble.h" -#include <gdk/gdk.h> - -#include "base/timer.h" -#include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_window.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/chromeos/volume_bubble_view.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/views/info_bubble.h" -#include "views/widget/root_view.h" - -namespace { - -const int kBubbleShowTimeoutSec = 2; -const int kAnimationDurationMs = 200; - -// Horizontal relative position: 0 - leftmost, 0.5 - center, 1 - rightmost. -const double kVolumeBubbleXRatio = 0.5; - -// Vertical gap from the bottom of the screen in pixels. -const int kVolumeBubbleBottomGap = 30; - -} // namespace +#include "app/resource_bundle.h" +#include "grit/theme_resources.h" namespace chromeos { -// Temporary helper routine. Returns the widget from the most-recently-focused -// normal browser window or NULL. -// TODO(glotov): remove this in favor of enabling InfoBubble class act -// without |parent| specified. crosbug.com/4025 -static views::Widget* GetToplevelWidget() { - // We just use the default profile here -- this gets overridden as needed - // in Chrome OS depending on whether the user is logged in or not. - Browser* browser = - BrowserList::FindBrowserWithType( - ProfileManager::GetDefaultProfile(), - Browser::TYPE_NORMAL, - true); // match_incognito - if (!browser) - return NULL; - - views::RootView* root = - views::Widget::FindRootView( - GTK_WINDOW(browser->window()->GetNativeHandle())); - DCHECK(root); - if (!root) - return NULL; - - return root->GetWidget(); -} - VolumeBubble::VolumeBubble() - : previous_percent_(-1), - current_percent_(-1), - bubble_(NULL), - view_(NULL), - animation_(this) { - animation_.SetSlideDuration(kAnimationDurationMs); - animation_.SetTweenType(Tween::LINEAR); -} - -void VolumeBubble::ShowVolumeBubble(int percent) { - if (percent < 0) - percent = 0; - if (percent > 100) - percent = 100; - if (previous_percent_ == -1) - previous_percent_ = percent; - current_percent_ = percent; - if (!bubble_) { - views::Widget* widget = GetToplevelWidget(); - if (widget == NULL) - return; - DCHECK(view_ == NULL); - view_ = new VolumeBubbleView; - view_->Init(previous_percent_); - // Calculate position of the volume bubble. - // TODO(glotov): Place volume bubble over the keys initiated the - // volume change. This metric must be specific to the given - // architecture. crosbug.com/4028 - gfx::Rect bounds; - widget->GetBounds(&bounds, false); - const gfx::Size view_size = view_->GetPreferredSize(); - // Note that (x, y) is the point of the center of the bubble. - const int x = view_size.width() / 2 + - kVolumeBubbleXRatio * (bounds.width() - view_size.width()); - const int y = bounds.height() - view_size.height() / 2 - - kVolumeBubbleBottomGap; - bubble_ = InfoBubble::ShowFocusless(widget, gfx::Rect(x, y, 0, 20), - BubbleBorder::FLOAT, view_, this); - } else { - DCHECK(view_); - timeout_timer_.Stop(); - } - if (animation_.is_animating()) - animation_.End(); - animation_.Reset(); - animation_.Show(); - timeout_timer_.Start(base::TimeDelta::FromSeconds(kBubbleShowTimeoutSec), - this, &VolumeBubble::OnTimeout); -} - -void VolumeBubble::OnTimeout() { - if (bubble_) - bubble_->Close(); -} - -void VolumeBubble::InfoBubbleClosing(InfoBubble* info_bubble, bool) { - DCHECK(info_bubble == bubble_); - timeout_timer_.Stop(); - animation_.Stop(); - bubble_ = NULL; - view_ = NULL; -} - -void VolumeBubble::AnimationEnded(const Animation* animation) { - previous_percent_ = current_percent_; -} - -void VolumeBubble::AnimationProgressed(const Animation* animation) { - if (view_) { - view_->Update( - Tween::ValueBetween(animation->GetCurrentValue(), - previous_percent_, - current_percent_)); - } + : SettingLevelBubble( + ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_VOLUMEBUBBLE_ICON)) { } } // namespace chromeos diff --git a/chrome/browser/chromeos/volume_bubble.h b/chrome/browser/chromeos/volume_bubble.h index 7496055..9d0ee57 100644 --- a/chrome/browser/chromeos/volume_bubble.h +++ b/chrome/browser/chromeos/volume_bubble.h @@ -6,58 +6,27 @@ #define CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ #pragma once -#include "app/animation_delegate.h" -#include "app/slide_animation.h" #include "base/singleton.h" -#include "base/timer.h" -#include "chrome/browser/views/info_bubble.h" +#include "chrome/browser/chromeos/setting_level_bubble.h" namespace chromeos { -class VolumeBubbleView; - // Singleton class controlling volume bubble. -class VolumeBubble : public InfoBubbleDelegate, - public AnimationDelegate { +class VolumeBubble : public SettingLevelBubble { public: static VolumeBubble* instance() { return Singleton<VolumeBubble>::get(); } - void ShowVolumeBubble(int percent); - private: friend struct DefaultSingletonTraits<VolumeBubble>; VolumeBubble(); - void OnTimeout(); - - // Overridden from InfoBubbleDelegate. - virtual void InfoBubbleClosing(InfoBubble* info_bubble, - bool closed_by_escape); - virtual bool CloseOnEscape() { return true; } - virtual bool FadeInOnShow() { return false; } - - // Overridden from AnimationDelegate. - virtual void AnimationEnded(const Animation* animation); - virtual void AnimationProgressed(const Animation* animation); - - // Previous and current volume percentages, -1 if not yet shown. - int previous_percent_; - int current_percent_; - - // Currently shown bubble or NULL. - InfoBubble* bubble_; - - // Its contents view, owned by InfoBubble. - VolumeBubbleView* view_; - - SlideAnimation animation_; - base::OneShotTimer<VolumeBubble> timeout_timer_; + virtual ~VolumeBubble() {} DISALLOW_COPY_AND_ASSIGN(VolumeBubble); }; -} // namespace +} // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ diff --git a/chrome/browser/chromeos/volume_bubble_view.cc b/chrome/browser/chromeos/volume_bubble_view.cc deleted file mode 100644 index 7bb500f..0000000 --- a/chrome/browser/chromeos/volume_bubble_view.cc +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/volume_bubble_view.h" - -#include <string> - -#include "app/resource_bundle.h" -#include "base/logging.h" -#include "gfx/canvas.h" -#include "grit/theme_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "views/controls/progress_bar.h" - -using views::Background; -using views::View; -using views::Widget; - -namespace { - -// Volume bubble metrics. -const int kWidth = 300, kHeight = 75; -const int kMargin = 25; -const int kProgressBarHeight = 20; - -} // namespace - -namespace chromeos { - -VolumeBubbleView::VolumeBubbleView() : progress_bar_(NULL) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - volume_icon_ = rb.GetBitmapNamed(IDR_VOLUMEBUBBLE_ICON); -} - -void VolumeBubbleView::Init(int volume_level_percent) { - DCHECK(volume_level_percent >= 0 && volume_level_percent <= 100); - progress_bar_ = new views::ProgressBar(); - AddChildView(progress_bar_); - Update(volume_level_percent); -} - -void VolumeBubbleView::Update(int volume_level_percent) { - DCHECK(volume_level_percent >= 0 && volume_level_percent <= 100); - progress_bar_->SetProgress(volume_level_percent); -} - -void VolumeBubbleView::Paint(gfx::Canvas* canvas) { - views::View::Paint(canvas); - canvas->DrawBitmapInt(*volume_icon_, - volume_icon_->width(), - (height() - volume_icon_->height()) / 2); -} - -void VolumeBubbleView::Layout() { - progress_bar_->SetBounds(volume_icon_->width() + kMargin * 2, - (height() - kProgressBarHeight) / 2, - width() - volume_icon_->width() - kMargin * 3, - kProgressBarHeight); -} - -gfx::Size VolumeBubbleView::GetPreferredSize() { - return gfx::Size(kWidth, kHeight); -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/volume_bubble_view.h b/chrome/browser/chromeos/volume_bubble_view.h deleted file mode 100644 index f9ec0b0..0000000 --- a/chrome/browser/chromeos/volume_bubble_view.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_VIEW_H_ -#define CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_VIEW_H_ -#pragma once - -#include "views/view.h" - -namespace views { -class ProgressBar; -} // namespace views - -class SkBitmap; - -namespace chromeos { - -class VolumeBubbleView : public views::View { - public: - VolumeBubbleView(); - - // Initialize the view. Set the volume progress bar to the specified position. - void Init(int volume_level_percent); - - // Set the volume progress bar to the specified position and redraw it. - void Update(int volume_level_percent); - - // views::View implementation: - virtual void Paint(gfx::Canvas* canvas); - virtual void Layout(); - virtual gfx::Size GetPreferredSize(); - - private: - views::ProgressBar* progress_bar_; - SkBitmap* volume_icon_; - - DISALLOW_COPY_AND_ASSIGN(VolumeBubbleView); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_VIEW_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0b4f991..06cc45a 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -711,6 +711,10 @@ 'browser/chromeos/proxy_cros_settings_provider.h', 'browser/chromeos/pulse_audio_mixer.cc', 'browser/chromeos/pulse_audio_mixer.h', + 'browser/chromeos/setting_level_bubble.cc', + 'browser/chromeos/setting_level_bubble.h', + 'browser/chromeos/setting_level_bubble_view.cc', + 'browser/chromeos/setting_level_bubble_view.h', 'browser/chromeos/status/clock_menu_button.cc', 'browser/chromeos/status/clock_menu_button.h', 'browser/chromeos/status/input_method_menu.cc', @@ -755,8 +759,6 @@ 'browser/chromeos/views/domui_menu_widget.h', 'browser/chromeos/volume_bubble.cc', 'browser/chromeos/volume_bubble.h', - 'browser/chromeos/volume_bubble_view.cc', - 'browser/chromeos/volume_bubble_view.h', 'browser/chromeos/wm_ipc.cc', 'browser/chromeos/wm_ipc.h', 'browser/chromeos/wm_message_listener.cc', |