| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/system/chromeos/power/video_activity_notifier.h" | 5 #include "ash/system/chromeos/power/video_activity_notifier.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_controller.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
| 11 #include "chromeos/dbus/power_manager_client.h" | 11 #include "chromeos/dbus/power_manager_client.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Minimum number of seconds between repeated notifications of the same state. | 16 // Minimum number of seconds between repeated notifications of the same state. |
| 17 // This should be less than powerd's timeout for determining whether video is | 17 // This should be less than powerd's timeout for determining whether video is |
| 18 // still active for the purposes of controlling the keyboard backlight. | 18 // still active for the purposes of controlling the keyboard backlight. |
| 19 const int kNotifyIntervalSec = 5; | 19 const int kNotifyIntervalSec = 5; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 VideoActivityNotifier::VideoActivityNotifier(VideoDetector* detector) | 23 VideoActivityNotifier::VideoActivityNotifier(VideoDetector* detector) |
| 24 : detector_(detector), | 24 : detector_(detector), |
| 25 video_state_(detector->state()), | 25 video_state_(detector->state()), |
| 26 screen_is_locked_( | 26 screen_is_locked_( |
| 27 Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { | 27 WmShell::Get()->session_controller()->IsScreenLocked()) { |
| 28 detector_->AddObserver(this); | 28 detector_->AddObserver(this); |
| 29 Shell::GetInstance()->AddShellObserver(this); | 29 Shell::GetInstance()->AddShellObserver(this); |
| 30 | 30 |
| 31 MaybeNotifyPowerManager(); | 31 MaybeNotifyPowerManager(); |
| 32 UpdateTimer(); | 32 UpdateTimer(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 VideoActivityNotifier::~VideoActivityNotifier() { | 35 VideoActivityNotifier::~VideoActivityNotifier() { |
| 36 Shell::GetInstance()->RemoveShellObserver(this); | 36 Shell::GetInstance()->RemoveShellObserver(this); |
| 37 detector_->RemoveObserver(this); | 37 detector_->RemoveObserver(this); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void VideoActivityNotifier::MaybeNotifyPowerManager() { | 74 void VideoActivityNotifier::MaybeNotifyPowerManager() { |
| 75 if (should_notify_power_manager()) { | 75 if (should_notify_power_manager()) { |
| 76 chromeos::DBusThreadManager::Get() | 76 chromeos::DBusThreadManager::Get() |
| 77 ->GetPowerManagerClient() | 77 ->GetPowerManagerClient() |
| 78 ->NotifyVideoActivity(video_state_ == | 78 ->NotifyVideoActivity(video_state_ == |
| 79 VideoDetector::State::PLAYING_FULLSCREEN); | 79 VideoDetector::State::PLAYING_FULLSCREEN); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace ash | 83 } // namespace ash |
| OLD | NEW |