Commit 2a52eddf authored by derat@chromium.org's avatar derat@chromium.org

chromeos: Minor changes to volume/brightness bubble UI.

This makes the bubbles ten pixels shorter and implements
the Bubble class's fade-in/fade-out behavior for GTK+ (which
also e.g. makes bookmark bubbles now fade away when you
click their "Done" buttons or "Remove" links, like on other
platforms).

BUG=chromium-os:8473
TEST=manual: configured the setting bubbles to fade in and out and checked that they looked correct

Review URL: http://codereview.chromium.org/7529038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96004 0039d316-1c4b-4281-b951-d872f2087c98
parent ad2c4d84
...@@ -130,6 +130,7 @@ void SettingLevelBubble::ShowBubble(int percent, bool enabled) { ...@@ -130,6 +130,7 @@ void SettingLevelBubble::ShowBubble(int percent, bool enabled) {
view_, // contents view_, // contents
this, // delegate this, // delegate
true); // show while screen is locked true); // show while screen is locked
bubble_->set_fade_away_on_close(true);
} else { } else {
DCHECK(view_); DCHECK(view_);
timeout_timer_.Stop(); timeout_timer_.Stop();
......
...@@ -18,7 +18,7 @@ using views::Widget; ...@@ -18,7 +18,7 @@ using views::Widget;
namespace { namespace {
// Bubble metrics. // Bubble metrics.
const int kWidth = 350, kHeight = 100; const int kWidth = 350, kHeight = 90;
const int kPadding = 20; const int kPadding = 20;
const int kProgressBarWidth = 211; const int kProgressBarWidth = 211;
const int kProgressBarHeight = 17; const int kProgressBarHeight = 17;
......
...@@ -106,10 +106,10 @@ void Bubble::AnimationEnded(const ui::Animation* animation) { ...@@ -106,10 +106,10 @@ void Bubble::AnimationEnded(const ui::Animation* animation) {
} }
void Bubble::AnimationProgressed(const ui::Animation* animation) { void Bubble::AnimationProgressed(const ui::Animation* animation) {
#if defined(OS_WIN)
// Set the opacity for the main contents window. // Set the opacity for the main contents window.
unsigned char opacity = static_cast<unsigned char>( unsigned char opacity = static_cast<unsigned char>(
animation_->GetCurrentValue() * 255); animation_->GetCurrentValue() * 255);
#if defined(OS_WIN)
SetLayeredWindowAttributes(GetNativeView(), 0, SetLayeredWindowAttributes(GetNativeView(), 0,
static_cast<byte>(opacity), LWA_ALPHA); static_cast<byte>(opacity), LWA_ALPHA);
contents_->SchedulePaint(); contents_->SchedulePaint();
...@@ -118,7 +118,8 @@ void Bubble::AnimationProgressed(const ui::Animation* animation) { ...@@ -118,7 +118,8 @@ void Bubble::AnimationProgressed(const ui::Animation* animation) {
border_->SetOpacity(opacity); border_->SetOpacity(opacity);
border_->border_contents()->SchedulePaint(); border_->border_contents()->SchedulePaint();
#else #else
NOTIMPLEMENTED(); SetOpacity(opacity);
border_contents_->SchedulePaint();
#endif #endif
} }
...@@ -175,6 +176,7 @@ void Bubble::InitBubble(views::Widget* parent, ...@@ -175,6 +176,7 @@ void Bubble::InitBubble(views::Widget* parent,
position_relative_to_ = position_relative_to; position_relative_to_ = position_relative_to;
arrow_location_ = arrow_location; arrow_location_ = arrow_location;
contents_ = contents; contents_ = contents;
const bool fade_in = delegate_ && delegate_->FadeInOnShow();
// Create the main window. // Create the main window.
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -185,7 +187,6 @@ void Bubble::InitBubble(views::Widget* parent, ...@@ -185,7 +187,6 @@ void Bubble::InitBubble(views::Widget* parent,
int extended_style = WS_EX_TOOLWINDOW; int extended_style = WS_EX_TOOLWINDOW;
// During FadeIn we need to turn on the layered window style to deal with // During FadeIn we need to turn on the layered window style to deal with
// transparency. This flag needs to be reset after fading in is complete. // transparency. This flag needs to be reset after fading in is complete.
bool fade_in = delegate_ && delegate_->FadeInOnShow();
if (fade_in) if (fade_in)
extended_style |= WS_EX_LAYERED; extended_style |= WS_EX_LAYERED;
set_window_ex_style(extended_style); set_window_ex_style(extended_style);
...@@ -214,6 +215,8 @@ void Bubble::InitBubble(views::Widget* parent, ...@@ -214,6 +215,8 @@ void Bubble::InitBubble(views::Widget* parent,
params.parent_widget = parent; params.parent_widget = parent;
params.native_widget = this; params.native_widget = this;
GetWidget()->Init(params); GetWidget()->Init(params);
if (fade_in)
SetOpacity(0);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
{ {
vector<int> params; vector<int> params;
...@@ -277,11 +280,12 @@ void Bubble::InitBubble(views::Widget* parent, ...@@ -277,11 +280,12 @@ void Bubble::InitBubble(views::Widget* parent,
#if defined(OS_WIN) #if defined(OS_WIN)
border_->ShowWindow(SW_SHOW); border_->ShowWindow(SW_SHOW);
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
if (fade_in)
FadeIn();
#elif defined(TOOLKIT_USES_GTK) #elif defined(TOOLKIT_USES_GTK)
GetWidget()->Show(); GetWidget()->Show();
#endif #endif
if (fade_in)
FadeIn();
} }
void Bubble::RegisterEscapeAccelerator() { void Bubble::RegisterEscapeAccelerator() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment