Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Unified Diff: views/widget/native_widget_aura.cc

Issue 8351042: Gets disable inactive frame rendering to work correctly for aura. This (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/native_widget_aura.h ('k') | views/widget/native_widget_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « views/widget/native_widget_aura.h ('k') | views/widget/native_widget_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698