Index: views/widget/native_widget_aura.cc |
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc |
index be5bf9b862fe10829037ce637d9c4ce32daf6f99..614864c10fa01e3f2db0ddd03207534f68e7a408 100644 |
--- a/views/widget/native_widget_aura.cc |
+++ b/views/widget/native_widget_aura.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "ui/aura/desktop.h" |
+#include "ui/aura/desktop_observer.h" |
#include "ui/aura/event.h" |
#include "ui/aura/window.h" |
#include "ui/aura/window_types.h" |
@@ -54,6 +55,33 @@ aura::WindowType GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) { |
} // namespace |
+// Used when SetInactiveRenderingDisabled() is invoked to track when active |
+// status changes in such a way that we should enable inactive rendering. |
+class NativeWidgetAura::DesktopObserverImpl : public aura::DesktopObserver { |
+ public: |
+ explicit DesktopObserverImpl(NativeWidgetAura* host) |
+ : host_(host) { |
+ aura::Desktop::GetInstance()->AddObserver(this); |
+ } |
+ |
+ virtual ~DesktopObserverImpl() { |
+ aura::Desktop::GetInstance()->RemoveObserver(this); |
+ } |
+ |
+ // DesktopObserver overrides: |
+ virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE { |
+ if (!active || (active != host_->window_ && |
+ active->transient_parent() != host_->window_)) { |
+ host_->delegate_->EnableInactiveRendering(); |
+ } |
+ } |
+ |
+ private: |
+ NativeWidgetAura* host_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DesktopObserverImpl); |
+}; |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// NativeWidgetAura, public: |
@@ -416,6 +444,7 @@ bool NativeWidgetAura::IsFullscreen() const { |
void NativeWidgetAura::SetOpacity(unsigned char opacity) { |
window_->layer()->SetOpacity(opacity / 255.0); |
+ window_->layer()->ScheduleDraw(); |
Ben Goodger (Google)
2011/11/01 19:22:00
Is this your other CL leaking through? I thought y
sky
2011/11/01 19:50:56
Ya, sorry. I'll remove that.
|
} |
void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { |
@@ -462,6 +491,13 @@ gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
return gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); |
} |
+void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { |
+ if (!value) |
+ desktop_observer_.reset(); |
+ else |
+ desktop_observer_.reset(new DesktopObserverImpl(this)); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// NativeWidgetAura, views::InputMethodDelegate implementation: |