summaryrefslogtreecommitdiffstats
path: root/ash/system
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-08 19:17:19 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-08 19:17:19 +0000
commit5c04d3a953f95665b448a6d74fee79c22ac9d375 (patch)
tree4de5e4c5ffcc2158df3bef177529dd421d710f2c /ash/system
parent00016895fdcf0a081d812369c13ae5b9a9f7f04f (diff)
downloadchromium_src-5c04d3a953f95665b448a6d74fee79c22ac9d375.zip
chromium_src-5c04d3a953f95665b448a6d74fee79c22ac9d375.tar.gz
chromium_src-5c04d3a953f95665b448a6d74fee79c22ac9d375.tar.bz2
Revert r227544, "chromeos: Move several power-related ..."
This broke the ASAN builders. BUG=none TBR=oshima@chromium.org Review URL: https://codereview.chromium.org/26561002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r--ash/system/chromeos/power/suspend_observer.cc72
-rw-r--r--ash/system/chromeos/power/suspend_observer.h49
-rw-r--r--ash/system/chromeos/power/user_activity_notifier.cc61
-rw-r--r--ash/system/chromeos/power/user_activity_notifier.h40
-rw-r--r--ash/system/chromeos/power/video_activity_notifier.cc41
-rw-r--r--ash/system/chromeos/power/video_activity_notifier.h37
6 files changed, 0 insertions, 300 deletions
diff --git a/ash/system/chromeos/power/suspend_observer.cc b/ash/system/chromeos/power/suspend_observer.cc
deleted file mode 100644
index 7e9119c..0000000
--- a/ash/system/chromeos/power/suspend_observer.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.
-
-#include "ash/system/chromeos/power/suspend_observer.h"
-
-#include "ash/session_state_delegate.h"
-#include "ash/shell.h"
-#include "ash/wm/user_activity_detector.h"
-#include "base/prefs/pref_service.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/display/output_configurator.h"
-
-namespace ash {
-namespace internal {
-
-SuspendObserver::SuspendObserver()
- : power_client_(
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()),
- session_client_(
- chromeos::DBusThreadManager::Get()->GetSessionManagerClient()),
- screen_locked_(false) {
- power_client_->AddObserver(this);
- session_client_->AddObserver(this);
-}
-
-SuspendObserver::~SuspendObserver() {
- session_client_->RemoveObserver(this);
- session_client_ = NULL;
- power_client_->RemoveObserver(this);
- power_client_ = NULL;
-}
-
-void SuspendObserver::SuspendImminent() {
- Shell* shell = Shell::GetInstance();
- SessionStateDelegate* delegate = shell->session_state_delegate();
-
- // If the lock-before-suspending pref is set, get a callback to block
- // suspend and ask the session manager to lock the screen.
- if (!screen_locked_ && delegate->ShouldLockScreenBeforeSuspending() &&
- delegate->CanLockScreen()) {
- screen_lock_callback_ = power_client_->GetSuspendReadinessCallback();
- VLOG(1) << "Requesting screen lock from SuspendObserver";
- session_client_->RequestLockScreen();
- }
-
- shell->user_activity_detector()->OnDisplayPowerChanging();
- shell->output_configurator()->SuspendDisplays();
-}
-
-void SuspendObserver::ScreenIsLocked() {
- screen_locked_ = true;
-
- // Stop blocking suspend after the screen is locked.
- if (!screen_lock_callback_.is_null()) {
- VLOG(1) << "Screen locked due to suspend";
- // Run the callback asynchronously. ScreenIsLocked() is currently
- // called asynchronously after RequestLockScreen(), but this guards
- // against it being made synchronous later.
- base::MessageLoop::current()->PostTask(FROM_HERE, screen_lock_callback_);
- screen_lock_callback_.Reset();
- } else {
- VLOG(1) << "Screen locked without suspend";
- }
-}
-
-void SuspendObserver::ScreenIsUnlocked() {
- screen_locked_ = false;
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/power/suspend_observer.h b/ash/system/chromeos/power/suspend_observer.h
deleted file mode 100644
index 17cc931..0000000
--- a/ash/system/chromeos/power/suspend_observer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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_SUSPEND_OBSERVER_H_
-#define ASH_SYSTEM_CHROMEOS_POWER_SUSPEND_OBSERVER_H_
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "chromeos/dbus/session_manager_client.h"
-
-namespace ash {
-namespace internal {
-
-// A class to observe suspend events.
-class SuspendObserver : public chromeos::PowerManagerClient::Observer,
- public chromeos::SessionManagerClient::Observer {
- public:
- // This class registers/unregisters itself as an observer in ctor/dtor.
- SuspendObserver();
- virtual ~SuspendObserver();
-
- // chromeos::PowerManagerClient::Observer override.
- virtual void SuspendImminent() OVERRIDE;
-
- // chromeos::SessionManagerClient::Observer overrides.
- virtual void ScreenIsLocked() OVERRIDE;
- virtual void ScreenIsUnlocked() OVERRIDE;
-
- private:
- chromeos::PowerManagerClient* power_client_; // not owned
- chromeos::SessionManagerClient* session_client_; // not owned
-
- // Is the screen currently locked?
- bool screen_locked_;
-
- // If set, called when the lock screen has been shown to confirm that the
- // system is ready to be suspended.
- base::Closure screen_lock_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(SuspendObserver);
-};
-
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_SYSTEM_CHROMEOS_POWER_SUSPEND_OBSERVER_H_
diff --git a/ash/system/chromeos/power/user_activity_notifier.cc b/ash/system/chromeos/power/user_activity_notifier.cc
deleted file mode 100644
index 921363c..0000000
--- a/ash/system/chromeos/power/user_activity_notifier.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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.
-
-#include "ash/system/chromeos/power/user_activity_notifier.h"
-
-#include "ash/shell.h"
-#include "ash/wm/user_activity_detector.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "ui/events/event.h"
-#include "ui/events/event_constants.h"
-#include "ui/events/keycodes/keyboard_codes_posix.h"
-
-namespace ash {
-namespace internal {
-
-namespace {
-
-// Minimum number of seconds between notifications.
-const int kNotifyIntervalSec = 5;
-
-} // namespace
-
-UserActivityNotifier::UserActivityNotifier(UserActivityDetector* detector)
- : detector_(detector) {
- detector_->AddObserver(this);
-}
-
-UserActivityNotifier::~UserActivityNotifier() {
- detector_->RemoveObserver(this);
-}
-
-void UserActivityNotifier::OnUserActivity(const ui::Event* event) {
- base::TimeTicks now = base::TimeTicks::Now();
- // InSeconds() truncates rather than rounding, so it's fine for this
- // comparison.
- if (last_notify_time_.is_null() ||
- (now - last_notify_time_).InSeconds() >= kNotifyIntervalSec) {
- power_manager::UserActivityType type = power_manager::USER_ACTIVITY_OTHER;
- if (event && event->type() == ui::ET_KEY_PRESSED) {
- switch (static_cast<const ui::KeyEvent*>(event)->key_code()) {
- case ui::VKEY_BRIGHTNESS_UP:
- type = power_manager::USER_ACTIVITY_BRIGHTNESS_UP_KEY_PRESS;
- break;
- case ui::VKEY_BRIGHTNESS_DOWN:
- type = power_manager::USER_ACTIVITY_BRIGHTNESS_DOWN_KEY_PRESS;
- break;
- default:
- break;
- }
- }
-
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- NotifyUserActivity(type);
- last_notify_time_ = now;
- }
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/power/user_activity_notifier.h b/ash/system/chromeos/power/user_activity_notifier.h
deleted file mode 100644
index 78b2c43..0000000
--- a/ash/system/chromeos/power/user_activity_notifier.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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_USER_ACTIVITY_NOTIFIER_H_
-#define ASH_SYSTEM_CHROMEOS_POWER_USER_ACTIVITY_NOTIFIER_H_
-
-#include "ash/wm/user_activity_observer.h"
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/time/time.h"
-
-namespace ash {
-
-class UserActivityDetector;
-
-namespace internal {
-
-// Notifies the power manager when the user is active.
-class UserActivityNotifier : public UserActivityObserver {
- public:
- explicit UserActivityNotifier(UserActivityDetector* detector);
- virtual ~UserActivityNotifier();
-
- // UserActivityObserver implementation.
- virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
-
- private:
- UserActivityDetector* detector_; // not owned
-
- // Last time that the power manager was notified.
- base::TimeTicks last_notify_time_;
-
- DISALLOW_COPY_AND_ASSIGN(UserActivityNotifier);
-};
-
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_SYSTEM_CHROMEOS_POWER_USER_ACTIVITY_NOTIFIER_H_
diff --git a/ash/system/chromeos/power/video_activity_notifier.cc b/ash/system/chromeos/power/video_activity_notifier.cc
deleted file mode 100644
index 0f9ec25..0000000
--- a/ash/system/chromeos/power/video_activity_notifier.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.
-
-#include "ash/system/chromeos/power/video_activity_notifier.h"
-
-#include "ash/shell.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
-
-namespace ash {
-namespace internal {
-
-namespace {
-
-// Minimum number of seconds between notifications.
-const int kNotifyIntervalSec = 5;
-
-} // namespace
-
-VideoActivityNotifier::VideoActivityNotifier(VideoDetector* detector)
- : detector_(detector) {
- detector_->AddObserver(this);
-}
-
-VideoActivityNotifier::~VideoActivityNotifier() {
- detector_->RemoveObserver(this);
-}
-
-void VideoActivityNotifier::OnVideoDetected(bool is_fullscreen) {
- base::TimeTicks now = base::TimeTicks::Now();
- if (last_notify_time_.is_null() ||
- (now - last_notify_time_).InSeconds() >= kNotifyIntervalSec) {
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- NotifyVideoActivity(is_fullscreen);
- last_notify_time_ = now;
- }
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/power/video_activity_notifier.h b/ash/system/chromeos/power/video_activity_notifier.h
deleted file mode 100644
index 66569c4..0000000
--- a/ash/system/chromeos/power/video_activity_notifier.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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_