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) {
view_, // contents
this, // delegate
true); // show while screen is locked
bubble_->set_fade_away_on_close(true);
} else {
DCHECK(view_);
timeout_timer_.Stop();
......
......@@ -18,7 +18,7 @@ using views::Widget;
namespace {
// Bubble metrics.
const int kWidth = 350, kHeight = 100;
const int kWidth = 350, kHeight = 90;
const int kPadding = 20;
const int kProgressBarWidth = 211;
const int kProgressBarHeight = 17;
......
......@@ -106,10 +106,10 @@ void Bubble::AnimationEnded(const ui::Animation* animation) {
}
void Bubble::AnimationProgressed(const ui::Animation* animation) {
#if defined(OS_WIN)
// Set the opacity for the main contents window.
unsigned char opacity = static_cast<unsigned char>(
animation_->GetCurrentValue() * 255);
#if defined(OS_WIN)
SetLayeredWindowAttributes(GetNativeView(), 0,
static_cast<byte>(opacity), LWA_ALPHA);
contents_->SchedulePaint();
......@@ -118,7 +118,8 @@ void Bubble::AnimationProgressed(const ui::Animation* animation) {
border_->SetOpacity(opacity);
border_->border_contents()->SchedulePaint();
#else
NOTIMPLEMENTED();
SetOpacity(opacity);
border_contents_->SchedulePaint();
#endif
}
......@@ -175,6 +176,7 @@ void Bubble::InitBubble(views::Widget* parent,
position_relative_to_ = position_relative_to;
arrow_location_ = arrow_location;
contents_ = contents;
const bool fade_in = delegate_ && delegate_->FadeInOnShow();
// Create the main window.
#if defined(OS_WIN)
......@@ -185,7 +187,6 @@ void Bubble::InitBubble(views::Widget* parent,
int extended_style = WS_EX_TOOLWINDOW;
// 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.
bool fade_in = delegate_ && delegate_->FadeInOnShow();
if (fade_in)
extended_style |= WS_EX_LAYERED;
set_window_ex_style(extended_style);
......@@ -214,6 +215,8 @@ void Bubble::InitBubble(views::Widget* parent,
params.parent_widget = parent;
params.native_widget = this;
GetWidget()->Init(params);
if (fade_in)
SetOpacity(0);
#if defined(OS_CHROMEOS)
{
vector<int> params;
......@@ -277,11 +280,12 @@ void Bubble::InitBubble(views::Widget* parent,
#if defined(OS_WIN)
border_->ShowWindow(SW_SHOW);
ShowWindow(SW_SHOW);
if (fade_in)
FadeIn();
#elif defined(TOOLKIT_USES_GTK)
GetWidget()->Show();
#endif
if (fade_in)
FadeIn();
}
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