diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-01 22:08:15 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-01 22:08:15 +0000 |
commit | 5a9374b19b1be32b4abfffb0a304f28ec6ccc72a (patch) | |
tree | 535c17c5a04be2959afffbe42288502b3745fd32 /chrome | |
parent | f32a8b30d6a18fa29e0a9ee5596eeae620a76599 (diff) | |
download | chromium_src-5a9374b19b1be32b4abfffb0a304f28ec6ccc72a.zip chromium_src-5a9374b19b1be32b4abfffb0a304f28ec6ccc72a.tar.gz chromium_src-5a9374b19b1be32b4abfffb0a304f28ec6ccc72a.tar.bz2 |
Gets disable inactive frame rendering to work correctly for aura. This
is needed for bubbles.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: http://codereview.chromium.org/8351042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
4 files changed, 32 insertions, 19 deletions
diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc index c72651e..f972eb0 100644 --- a/chrome/browser/ui/views/bubble/bubble.cc +++ b/chrome/browser/ui/views/bubble/bubble.cc @@ -196,11 +196,9 @@ void Bubble::InitBubble(views::Widget* parent, // Create the main window. #if defined(USE_AURA) - // TODO(beng): - NOTIMPLEMENTED(); - // NOTE: This Widget initialization here is mostly to paper over a crash. - // This will soon be not necessary anymore with alicet/msw's work on new - // bubbles infrastructure. + views::Widget* parent_window = parent->GetTopLevelWidget(); + if (parent_window) + parent_window->DisableInactiveRendering(); views::Widget::InitParams params; params.transparent = true; params.parent_widget = parent; diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index dd30f6f..72213b2 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -59,7 +59,7 @@ void BrowserFrame::InitBrowserFrame() { params.keep_on_top = true; } Init(params); -#if defined(OS_CHROMEOS) +#if defined(OS_CHROMEOS) && !defined(USE_AURA) // On ChromeOS we always want top-level windows to appear active. if (!browser_view_->IsBrowserTypePopup()) DisableInactiveRendering(); diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc index b77b80c..d989108 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc @@ -259,7 +259,8 @@ int BrowserNonClientFrameViewAura::NonClientHitTestImpl( // OnWidgetActivationChanged() to be called before GetWidget()->IsActive() // changes state. gfx::Rect BrowserNonClientFrameViewAura::GetFrameBackgroundBounds( - int hittest_code, bool active_window) { + int hittest_code, + bool active_window) { bool show_left = false; bool show_top = false; bool show_right = false; @@ -320,6 +321,18 @@ void BrowserNonClientFrameViewAura::UpdateFrameBackground(bool active_window) { frame_background_->Configure(start_bounds, end_bounds); } +void BrowserNonClientFrameViewAura::ActiveStateChanged() { + bool active = ShouldPaintAsActive(); + // Active windows have different background bounds. + UpdateFrameBackground(active); + if (active) + frame_background_->Show(); + else + frame_background_->Hide(); + maximize_button_->SetVisible(active); + close_button_->SetVisible(active); +} + /////////////////////////////////////////////////////////////////////////////// // BrowserNonClientFrameView overrides: @@ -397,6 +410,10 @@ void BrowserNonClientFrameViewAura::UpdateWindowIcon() { // TODO(jamescook): We will need this for app frames. } +void BrowserNonClientFrameViewAura::ShouldPaintAsActiveChanged() { + ActiveStateChanged(); +} + /////////////////////////////////////////////////////////////////////////////// // views::View overrides: @@ -410,7 +427,7 @@ void BrowserNonClientFrameViewAura::Layout() { preferred = maximize_button_->GetPreferredSize(); maximize_button_->SetBounds(right - preferred.width(), kTopBorderThickness, preferred.width(), preferred.height()); - UpdateFrameBackground(GetWidget()->IsActive()); + UpdateFrameBackground(ShouldPaintAsActive()); } views::View* BrowserNonClientFrameViewAura::GetEventHandlerForPoint( @@ -456,7 +473,7 @@ bool BrowserNonClientFrameViewAura::HitTest(const gfx::Point& p) const { void BrowserNonClientFrameViewAura::OnMouseMoved( const views::MouseEvent& event) { // We may be hovering over the resize edge. - UpdateFrameBackground(GetWidget()->IsActive()); + UpdateFrameBackground(ShouldPaintAsActive()); frame_background_->Show(); } @@ -515,16 +532,10 @@ void BrowserNonClientFrameViewAura::ButtonPressed(views::Button* sender, } /////////////////////////////////////////////////////////////////////////////// -// views::ButtonListener overrides: +// views::Widget::Observer overrides: void BrowserNonClientFrameViewAura::OnWidgetActivationChanged( - views::Widget* widget, bool active) { - // Active windows have different background bounds. - UpdateFrameBackground(active); - if (active) - frame_background_->Show(); - else - frame_background_->Hide(); - maximize_button_->SetVisible(active); - close_button_->SetVisible(active); + views::Widget* widget, + bool active) { + ActiveStateChanged(); } diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h index db3cc58..df41aa9 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h @@ -42,6 +42,9 @@ class BrowserNonClientFrameViewAura : public BrowserNonClientFrameView, // Recomputes the bounds of the semi-transparent frame background. void UpdateFrameBackground(bool active_window); + // Invoked when the active state changes. + void ActiveStateChanged(); + // BrowserNonClientFrameView overrides: virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; virtual int GetHorizontalTabStripVerticalOffset(bool restored) const OVERRIDE; @@ -58,6 +61,7 @@ class BrowserNonClientFrameViewAura : public BrowserNonClientFrameView, virtual void EnableClose(bool enable) OVERRIDE; virtual void ResetWindowControls() OVERRIDE; virtual void UpdateWindowIcon() OVERRIDE; + virtual void ShouldPaintAsActiveChanged() OVERRIDE; // views::View overrides: virtual void Layout() OVERRIDE; |