diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 00:43:34 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 00:43:34 +0000 |
commit | 7d692835b4257b2621f969037f52e1dca67d833e (patch) | |
tree | f4523fd166096b65f44163e81d546d2c2d3d5223 /ash/wm/video_detector.h | |
parent | f45df627895d165d4762b4b66cea359de34b577a (diff) | |
download | chromium_src-7d692835b4257b2621f969037f52e1dca67d833e.zip chromium_src-7d692835b4257b2621f969037f52e1dca67d833e.tar.gz chromium_src-7d692835b4257b2621f969037f52e1dca67d833e.tar.bz2 |
Revert "aura/chromeos: Avoid suspending while video is playing."
This reverts r118171. There's an issue in the destruction
order of ash::VideoDetector vs. ash::Shell.
BUG=110114
TEST=built it
TBR=apatrick
Review URL: https://chromiumcodereview.appspot.com/9232037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/video_detector.h')
-rw-r--r-- | ash/wm/video_detector.h | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/ash/wm/video_detector.h b/ash/wm/video_detector.h deleted file mode 100644 index d6778b6..0000000 --- a/ash/wm/video_detector.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_WM_VIDEO_DETECTOR_H_ -#define ASH_WM_VIDEO_DETECTOR_H_ -#pragma once - -#include <map> - -#include "ash/ash_export.h" -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/memory/linked_ptr.h" -#include "base/observer_list.h" -#include "base/time.h" -#include "ui/aura/root_window_observer.h" -#include "ui/aura/window_observer.h" - -namespace aura { -class Window; -} - -namespace gfx { -class Rect; -} - -namespace ash { - -class ASH_EXPORT VideoDetectorObserver { - public: - // Invoked periodically while a video is being played onscreen. - virtual void OnVideoDetected() = 0; - - protected: - virtual ~VideoDetectorObserver() {} -}; - -// Watches for updates to windows and tries to detect when a video is playing. -// We err on the side of false positives and can be fooled by things like -// continuous scrolling of a page. -class ASH_EXPORT VideoDetector : public aura::RootWindowObserver, - public aura::WindowObserver { - public: - // Minimum dimensions in pixels that a window update must have to be - // considered a potential video frame. - static const int kMinUpdateWidth; - static const int kMinUpdateHeight; - - // Number of video-sized updates that we must see within a second in a window - // before we assume that a video is playing. - static const int kMinFramesPerSecond; - - // Minimum amount of time between notifications to observers that a video is - // playing. - static const double kNotifyIntervalSec; - - VideoDetector(); - virtual ~VideoDetector(); - - void set_now_for_test(base::TimeTicks now) { now_for_test_ = now; } - - void AddObserver(VideoDetectorObserver* observer); - void RemoveObserver(VideoDetectorObserver* observer); - - // RootWindowObserver overrides. - virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; - - // WindowObserver overrides. - virtual void OnWindowPaintScheduled(aura::Window* window, - const gfx::Rect& region) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; - - private: - class WindowInfo; - typedef std::map<aura::Window*, linked_ptr<WindowInfo> > WindowInfoMap; - - // Possibly notifies observers in response to detection of a video in - // |window|. Notifications are rate-limited and don't get sent if the window - // is invisible or offscreen. - void MaybeNotifyObservers(aura::Window* window, base::TimeTicks now); - - // Maps from a window that we're tracking to information about it. - WindowInfoMap window_infos_; - - ObserverList<VideoDetectorObserver> observers_; - - // Last time at which we notified observers that a video was playing. - base::TimeTicks last_observer_notification_time_; - - // If set, used when the current time is needed. This can be set by tests to - // simulate the passage of time. - base::TimeTicks now_for_test_; - - DISALLOW_COPY_AND_ASSIGN(VideoDetector); -}; - -} // namespace ash - -#endif // ASH_WM_VIDEO_DETECTOR_H_ |