summaryrefslogtreecommitdiffstats
path: root/ash/system/chromeos/power/video_activity_notifier.h
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-09 07:56:55 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-09 07:56:55 +0000
commitded58fd466862cb75930af93350f9cb9c9bacea3 (patch)
treee356d8b92f9e5675ec5810ee7676e35b855f2ccb /ash/system/chromeos/power/video_activity_notifier.h
parent3f0855c057b90feb3f77176d67d990d9e8d1097c (diff)
downloadchromium_src-ded58fd466862cb75930af93350f9cb9c9bacea3.zip
chromium_src-ded58fd466862cb75930af93350f9cb9c9bacea3.tar.gz
chromium_src-ded58fd466862cb75930af93350f9cb9c9bacea3.tar.bz2
Reland "chromeos: Move several power-related classes to Ash"
This reverts r227562 to reland r227544. Original description: "Move SuspendObserver, UserActivityNotifier, and VideoActivityNotifier from chrome/browser/chromeos/power to ash/system/chromeos/power." This iteration makes ash::Shell's destructor destroy VideoActivityNotifier before VideoDetector to avoid a use-after-free. BUG=none Review URL: https://codereview.chromium.org/26569003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/chromeos/power/video_activity_notifier.h')
-rw-r--r--ash/system/chromeos/power/video_activity_notifier.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/ash/system/chromeos/power/video_activity_notifier.h b/ash/system/chromeos/power/video_activity_notifier.h
new file mode 100644
index 0000000..66569c4
--- /dev/null
+++ b/ash/system/chromeos/power/video_activity_notifier.h
@@ -0,0 +1,37 @@
+// Copyright 2013 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_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_
+#define ASH_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_
+
+#include "ash/wm/video_detector.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/time/time.h"
+
+namespace ash {
+namespace internal {
+
+// Notifies the power manager when a video is playing.
+class VideoActivityNotifier : public VideoDetectorObserver {
+ public:
+ explicit VideoActivityNotifier(VideoDetector* detector);
+ virtual ~VideoActivityNotifier();
+
+ // VideoDetectorObserver implementation.
+ virtual void OnVideoDetected(bool is_fullscreen) OVERRIDE;
+
+ private:
+ VideoDetector* detector_; // not owned
+
+ // Last time that the power manager was notified.
+ base::TimeTicks last_notify_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoActivityNotifier);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_