Home | History | Annotate | Download | only in power
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_
      6 #define ASH_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_
      7 
      8 #include "ash/wm/video_detector.h"
      9 #include "base/basictypes.h"
     10 #include "base/compiler_specific.h"
     11 #include "base/time/time.h"
     12 
     13 namespace ash {
     14 
     15 // Notifies the power manager when a video is playing.
     16 class VideoActivityNotifier : public VideoDetectorObserver,
     17                               public ShellObserver {
     18  public:
     19   explicit VideoActivityNotifier(VideoDetector* detector);
     20   virtual ~VideoActivityNotifier();
     21 
     22   // VideoDetectorObserver implementation.
     23   virtual void OnVideoDetected(bool is_fullscreen) OVERRIDE;
     24 
     25   // ShellObserver implementation.
     26   virtual void OnLockStateChanged(bool locked) OVERRIDE;
     27 
     28  private:
     29   VideoDetector* detector_;  // not owned
     30 
     31   // Last time that the power manager was notified.
     32   base::TimeTicks last_notify_time_;
     33 
     34   // True if the screen is currently locked.
     35   bool screen_is_locked_;
     36 
     37   DISALLOW_COPY_AND_ASSIGN(VideoActivityNotifier);
     38 };
     39 
     40 }  // namespace ash
     41 
     42 #endif  // ASH_SYSTEM_CHROMEOS_POWER_VIDEO_ACTIVITY_NOTIFIER_H_
     43