summaryrefslogtreecommitdiffstats
path: root/ui/aura/window.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 22:26:40 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 22:26:40 +0000
commita3102766e725636ad23ad99faa1e8a481a1129e7 (patch)
treecea797379b158ff00fb8d4b2e86c67046b548946 /ui/aura/window.cc
parent8431abd52eb3f7cc0eb9812933fe3eb5e83def45 (diff)
downloadchromium_src-a3102766e725636ad23ad99faa1e8a481a1129e7.zip
chromium_src-a3102766e725636ad23ad99faa1e8a481a1129e7.tar.gz
chromium_src-a3102766e725636ad23ad99faa1e8a481a1129e7.tar.bz2
aura/chromeos: Avoid suspending while video is playing.
This adds an ash::VideoDetector class that watches for layer updates and attempts to detect the playback of video. A Chrome OS-specific observer updates a _CHROME_VIDEO_TIME property on the X root window, which is used by the power manager to defer screen dimming or other power management features. This matches the implementation currently in use on Chrome OS, with Chrome taking the X window manager's role for detecting video and setting the property. BUG=110114 TEST=added; also manually checked that the property is updated Review URL: http://codereview.chromium.org/9249004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118171 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/window.cc')
-rw-r--r--ui/aura/window.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index b0a1ed6..a168501 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -153,6 +153,8 @@ const gfx::Rect& Window::bounds() const {
void Window::SchedulePaintInRect(const gfx::Rect& rect) {
layer_->SchedulePaint(rect);
+ FOR_EACH_OBSERVER(
+ WindowObserver, observers_, OnWindowPaintScheduled(this, rect));
}
void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) {
@@ -161,6 +163,16 @@ void Window::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) {
// to be unhappy if we try to set a texture on a size bigger than the size of
// the texture.
layer_->SetCanvas(canvas, origin);
+ gfx::Rect region(gfx::Point(), bounds().size());
+ FOR_EACH_OBSERVER(
+ WindowObserver, observers_, OnWindowPaintScheduled(this, region));
+}
+
+void Window::SetExternalTexture(ui::Texture* texture) {
+ layer_->SetExternalTexture(texture);
+ gfx::Rect region(gfx::Point(), bounds().size());
+ FOR_EACH_OBSERVER(
+ WindowObserver, observers_, OnWindowPaintScheduled(this, region));
}
void Window::SetParent(Window* parent) {