Commit 4b80aecb authored by mattm@chromium.org's avatar mattm@chromium.org

Revert 162140 - ash : Decouple power button controller and session state controller.

Prepare code to introduce two versions of SessionStateController later.

BUG=138171, 139461


Review URL: https://chromiumcodereview.appspot.com/11091023

TBR=antrim@chromium.org
Review URL: https://codereview.chromium.org/11185006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162201 0039d316-1c4b-4281-b951-d872f2087c98
parent 44a4b566
...@@ -327,8 +327,6 @@ ...@@ -327,8 +327,6 @@
'wm/screen_dimmer.h', 'wm/screen_dimmer.h',
'wm/session_state_animator.cc', 'wm/session_state_animator.cc',
'wm/session_state_animator.h', 'wm/session_state_animator.h',
'wm/session_state_controller.cc',
'wm/session_state_controller.h',
'wm/shadow.cc', 'wm/shadow.cc',
'wm/shadow.h', 'wm/shadow.h',
'wm/shadow_controller.cc', 'wm/shadow_controller.cc',
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "ash/wm/resize_shadow_controller.h" #include "ash/wm/resize_shadow_controller.h"
#include "ash/wm/root_window_layout_manager.h" #include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/screen_dimmer.h" #include "ash/wm/screen_dimmer.h"
#include "ash/wm/session_state_controller.h"
#include "ash/wm/shadow_controller.h" #include "ash/wm/shadow_controller.h"
#include "ash/wm/stacking_controller.h" #include "ash/wm/stacking_controller.h"
#include "ash/wm/system_gesture_event_filter.h" #include "ash/wm/system_gesture_event_filter.h"
...@@ -248,7 +247,6 @@ Shell::~Shell() { ...@@ -248,7 +247,6 @@ Shell::~Shell() {
drag_drop_controller_.reset(); drag_drop_controller_.reset();
magnification_controller_.reset(); magnification_controller_.reset();
power_button_controller_.reset(); power_button_controller_.reset();
session_state_controller_.reset();
resize_shadow_controller_.reset(); resize_shadow_controller_.reset();
shadow_controller_.reset(); shadow_controller_.reset();
tooltip_controller_.reset(); tooltip_controller_.reset();
...@@ -490,10 +488,8 @@ void Shell::Init() { ...@@ -490,10 +488,8 @@ void Shell::Init() {
// the correct size. // the correct size.
user_wallpaper_delegate_->InitializeWallpaper(); user_wallpaper_delegate_->InitializeWallpaper();
session_state_controller_.reset(new SessionStateController); power_button_controller_.reset(new PowerButtonController);
power_button_controller_.reset(new PowerButtonController( AddShellObserver(power_button_controller_.get());
session_state_controller_.get()));
AddShellObserver(session_state_controller_.get());
if (initially_hide_cursor_) if (initially_hide_cursor_)
cursor_manager_.ShowCursor(false); cursor_manager_.ShowCursor(false);
......
...@@ -68,7 +68,6 @@ class Launcher; ...@@ -68,7 +68,6 @@ class Launcher;
class NestedDispatcherController; class NestedDispatcherController;
class PowerButtonController; class PowerButtonController;
class ScreenAsh; class ScreenAsh;
class SessionStateController;
class ShellDelegate; class ShellDelegate;
class ShellObserver; class ShellObserver;
class SystemTrayDelegate; class SystemTrayDelegate;
...@@ -274,9 +273,6 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{ ...@@ -274,9 +273,6 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
PowerButtonController* power_button_controller() { PowerButtonController* power_button_controller() {
return power_button_controller_.get(); return power_button_controller_.get();
} }
SessionStateController* session_state_controller() {
return session_state_controller_.get();
}
UserActivityDetector* user_activity_detector() { UserActivityDetector* user_activity_detector() {
return user_activity_detector_.get(); return user_activity_detector_.get();
} }
...@@ -448,7 +444,6 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{ ...@@ -448,7 +444,6 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
scoped_ptr<internal::VisibilityController> visibility_controller_; scoped_ptr<internal::VisibilityController> visibility_controller_;
scoped_ptr<DesktopBackgroundController> desktop_background_controller_; scoped_ptr<DesktopBackgroundController> desktop_background_controller_;
scoped_ptr<PowerButtonController> power_button_controller_; scoped_ptr<PowerButtonController> power_button_controller_;
scoped_ptr<SessionStateController> session_state_controller_;
scoped_ptr<UserActivityDetector> user_activity_detector_; scoped_ptr<UserActivityDetector> user_activity_detector_;
scoped_ptr<VideoDetector> video_detector_; scoped_ptr<VideoDetector> video_detector_;
scoped_ptr<WindowCycleController> window_cycle_controller_; scoped_ptr<WindowCycleController> window_cycle_controller_;
......
This diff is collapsed.
...@@ -6,8 +6,13 @@ ...@@ -6,8 +6,13 @@
#define ASH_WM_POWER_BUTTON_CONTROLLER_H_ #define ASH_WM_POWER_BUTTON_CONTROLLER_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/shell_observer.h"
#include "ash/wm/session_state_animator.h" #include "ash/wm/session_state_animator.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "base/timer.h"
#include "ui/aura/root_window_observer.h"
namespace gfx { namespace gfx {
class Rect; class Rect;
...@@ -20,20 +25,109 @@ class Layer; ...@@ -20,20 +25,109 @@ class Layer;
namespace ash { namespace ash {
namespace test { // Performs system-related functions on behalf of PowerButtonController.
class PowerButtonControllerTest; class ASH_EXPORT PowerButtonControllerDelegate {
} public:
PowerButtonControllerDelegate() {}
virtual ~PowerButtonControllerDelegate() {}
class SessionStateController; virtual void RequestLockScreen() = 0;
virtual void RequestShutdown() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(PowerButtonControllerDelegate);
};
// Displays onscreen animations and locks or suspends the system in response to // Displays onscreen animations and locks or suspends the system in response to
// the power button being pressed or released. // the power button being pressed or released.
class ASH_EXPORT PowerButtonController { class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
public ShellObserver {
public: public:
explicit PowerButtonController(SessionStateController* controller); // Helper class used by tests to access internal state.
class ASH_EXPORT TestApi {
public:
explicit TestApi(PowerButtonController* controller);
virtual ~TestApi();
bool lock_timer_is_running() const {
return controller_->lock_timer_.IsRunning();
}
bool lock_fail_timer_is_running() const {
return controller_->lock_fail_timer_.IsRunning();
}
bool lock_to_shutdown_timer_is_running() const {
return controller_->lock_to_shutdown_timer_.IsRunning();
}
bool shutdown_timer_is_running() const {
return controller_->shutdown_timer_.IsRunning();
}
bool real_shutdown_timer_is_running() const {
return controller_->real_shutdown_timer_.IsRunning();
}
bool hide_black_layer_timer_is_running() const {
return animator_api_->hide_black_layer_timer_is_running();
}
void trigger_lock_timeout() {
controller_->OnLockTimeout();
controller_->lock_timer_.Stop();
}
void trigger_lock_fail_timeout() {
controller_->OnLockFailTimeout();
controller_->lock_fail_timer_.Stop();
}
void trigger_lock_to_shutdown_timeout() {
controller_->OnLockToShutdownTimeout();
controller_->lock_to_shutdown_timer_.Stop();
}
void trigger_shutdown_timeout() {
controller_->OnShutdownTimeout();
controller_->shutdown_timer_.Stop();
}
void trigger_real_shutdown_timeout() {
controller_->OnRealShutdownTimeout();
controller_->real_shutdown_timer_.Stop();
}
void TriggerHideBlackLayerTimeout() {
animator_api_->TriggerHideBlackLayerTimeout();
}
// Returns true if containers of a given |container_mask|
// were last animated with |type| (probably; the analysis is fairly ad-hoc).
// |container_mask| is a bitfield of a Container.
bool ContainersAreAnimated(int container_mask,
internal::SessionStateAnimator::AnimationType type) const {
return animator_api_->ContainersAreAnimated(container_mask, type);
}
// Returns true if |black_layer_| is non-NULL and visible.
bool BlackLayerIsVisible() {
return animator_api_->BlackLayerIsVisible();
}
// Returns |black_layer_|'s bounds, or an empty rect if the layer is
// NULL.
gfx::Rect GetBlackLayerBounds() const {
return animator_api_->GetBlackLayerBounds();
}
private:
PowerButtonController* controller_; // not owned
scoped_ptr<internal::SessionStateAnimator::TestApi> animator_api_;
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
PowerButtonController();
virtual ~PowerButtonController(); virtual ~PowerButtonController();
void set_delegate(PowerButtonControllerDelegate* delegate) {
delegate_.reset(delegate);
}
void set_has_legacy_power_button_for_test(bool legacy) { void set_has_legacy_power_button_for_test(bool legacy) {
has_legacy_power_button_ = legacy; has_legacy_power_button_ = legacy;
} }
...@@ -41,12 +135,56 @@ class ASH_EXPORT PowerButtonController { ...@@ -41,12 +135,56 @@ class ASH_EXPORT PowerButtonController {
// Called when the current screen brightness changes. // Called when the current screen brightness changes.
void OnScreenBrightnessChanged(double percent); void OnScreenBrightnessChanged(double percent);
// Called when Chrome gets a request to display the lock screen.
void OnStartingLock();
// Called when the power or lock buttons are pressed or released. // Called when the power or lock buttons are pressed or released.
void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp);
// Displays the shutdown animation and requests shutdown when it's done.
void RequestShutdown();
virtual void OnRootWindowHostCloseRequested(
const aura::RootWindow* root) OVERRIDE;
// ShellObserver overrides:
virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
virtual void OnAppTerminating() OVERRIDE;
virtual void OnLockStateChanged(bool locked) OVERRIDE;
private: private:
friend class test::PowerButtonControllerTest; bool LoggedInAsNonGuest() const;
// Requests that the screen be locked and starts |lock_fail_timer_|.
void OnLockTimeout();
// Aborts the pre-lock animation.
void OnLockFailTimeout();
// Displays the pre-shutdown animation and starts |shutdown_timer_|.
void OnLockToShutdownTimeout();
// Calls StartShutdownAnimationAndRequestShutdown().
void OnShutdownTimeout();
// Requests that the machine be shut down.
void OnRealShutdownTimeout();
// Puts us into the pre-lock or pre-shutdown state.
void StartLockTimer();
void StartShutdownTimer();
// Displays the shutdown animation and starts |real_shutdown_timer_|.
void StartShutdownAnimationAndRequestShutdown();
scoped_ptr<PowerButtonControllerDelegate> delegate_;
// The current login status.
user::LoginStatus login_status_;
// Original login status during locked. LOGGED_IN_NONE if it's not locked.
user::LoginStatus unlocked_login_status_;
// Are the power or lock buttons currently held? // Are the power or lock buttons currently held?
bool power_button_down_; bool power_button_down_;
...@@ -55,11 +193,37 @@ class ASH_EXPORT PowerButtonController { ...@@ -55,11 +193,37 @@ class ASH_EXPORT PowerButtonController {
// Is the screen currently turned off? // Is the screen currently turned off?
bool screen_is_off_; bool screen_is_off_;
// Are we in the process of shutting the machine down?
bool shutting_down_;
// Was a command-line switch set telling us that we're running on hardware // Was a command-line switch set telling us that we're running on hardware
// that misreports power button releases? // that misreports power button releases?
bool has_legacy_power_button_; bool has_legacy_power_button_;
SessionStateController* controller_; // Not owned. // Started when the user first presses the power button while in a
// logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the
// screen.
base::OneShotTimer<PowerButtonController> lock_timer_;
// Started when we request that the screen be locked. When it fires, we
// assume that our request got dropped.
base::OneShotTimer<PowerButtonController> lock_fail_timer_;
// Started when the screen is locked while the power button is held. Adds a
// delay between the appearance of the lock screen and the beginning of the
// pre-shutdown animation.
base::OneShotTimer<PowerButtonController> lock_to_shutdown_timer_;
// Started when we begin displaying the pre-shutdown animation. When it
// fires, we start the shutdown animation and get ready to request shutdown.
base::OneShotTimer<PowerButtonController> shutdown_timer_;
// Started when we display the shutdown animation. When it fires, we actually
// request shutdown. Gives the animation time to complete before Chrome, X,
// etc. are shut down.
base::OneShotTimer<PowerButtonController> real_shutdown_timer_;
scoped_ptr<internal::SessionStateAnimator> animator_;
DISALLOW_COPY_AND_ASSIGN(PowerButtonController); DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
}; };
......
This diff is collapsed.
This diff is collapsed.
// 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_SESSION_STATE_CONTROLLER_H_
#define ASH_WM_SESSION_STATE_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/shell_observer.h"
#include "ash/wm/session_state_animator.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "base/timer.h"
#include "ui/aura/root_window_observer.h"
namespace gfx {
class Rect;
class Size;
}
namespace ui {
class Layer;
}
namespace ash {
namespace test {
class PowerButtonControllerTest;
}
// Performs system-related functions on behalf of SessionStateController.
class ASH_EXPORT SessionStateControllerDelegate {
public:
SessionStateControllerDelegate() {}
virtual ~SessionStateControllerDelegate() {}
virtual void RequestLockScreen() = 0;
virtual void RequestShutdown() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(SessionStateControllerDelegate);
};
// Displays onscreen animations and locks or suspends the system in response to
// the power button being pressed or released.
class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
public ShellObserver {
public:
// Amount of time that the power button needs to be held before we lock the
// screen.
static const int kLockTimeoutMs;
// Amount of time that the power button needs to be held before we shut down.
static const int kShutdownTimeoutMs;
// Amount of time to wait for our lock requests to be honored before giving
// up.
static const int kLockFailTimeoutMs;
// When the button has been held continuously from the unlocked state, amount
// of time that we wait after the screen locker window is shown before
// starting the pre-shutdown animation.
static const int kLockToShutdownTimeoutMs;
// Amount of time taken to scale the snapshot of the screen down to a
// slightly-smaller size once the user starts holding the power button. Used
// for both the pre-lock and pre-shutdown animations.
static const int kSlowCloseAnimMs;
// Amount of time taken to scale the snapshot of the screen back to its
// original size when the button is released.
static const int kUndoSlowCloseAnimMs;
// Amount of time taken to scale the snapshot down to a point in the center of
// the screen once the screen has been locked or we've been notified that the
// system is shutting down.
static const int kFastCloseAnimMs;
// Additional time (beyond kFastCloseAnimMs) to wait after starting the
// fast-close shutdown animation before actually requesting shutdown, to give
// the animation time to finish.
static const int kShutdownRequestDelayMs;
// Helper class used by tests to access internal state.
class ASH_EXPORT TestApi {
public:
explicit TestApi(SessionStateController* controller);
virtual ~TestApi();
bool lock_timer_is_running() const {
return controller_->lock_timer_.IsRunning();
}
bool lock_fail_timer_is_running() const {
return controller_->lock_fail_timer_.IsRunning();
}
bool lock_to_shutdown_timer_is_running() const {
return controller_->lock_to_shutdown_timer_.IsRunning();
}
bool shutdown_timer_is_running() const {
return controller_->pre_shutdown_timer_.IsRunning();
}
bool real_shutdown_timer_is_running() const {
return controller_->real_shutdown_timer_.IsRunning();
}
void trigger_lock_timeout() {
controller_->OnLockTimeout();
controller_->lock_timer_.Stop();
}
void trigger_lock_fail_timeout() {
controller_->OnLockFailTimeout();
controller_->lock_fail_timer_.Stop();
}
void trigger_lock_to_shutdown_timeout() {
controller_->OnLockToShutdownTimeout();
controller_->lock_to_shutdown_timer_.Stop();
}
void trigger_shutdown_timeout() {
controller_->OnPreShutdownAnimationTimeout();
controller_->pre_shutdown_timer_.Stop();
}
void trigger_real_shutdown_timeout() {
controller_->OnRealShutdownTimeout();
controller_->real_shutdown_timer_.Stop();
}
private:
SessionStateController* controller_; // not owned
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
SessionStateController();
virtual ~SessionStateController();
// RootWindowObserver override:
virtual void OnRootWindowHostCloseRequested(
const aura::RootWindow* root) OVERRIDE;
// ShellObserver overrides:
virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
virtual void OnAppTerminating() OVERRIDE;
virtual void OnLockStateChanged(bool locked) OVERRIDE;
void SetDelegate(SessionStateControllerDelegate* delegate);
// Returns true iff when we're in state when user session can be locked.
virtual bool IsEligibleForLock();
// Returns true if system is locked.
virtual bool IsLocked();
// Starts locking (with slow animation) that can be cancelled.
// After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation()
// will be called unless CancelShutdown() is called.
virtual void StartLockAnimation();
// Starts shutting down (with slow animation) that can be cancelled.
virtual void StartShutdownAnimation();
// Starts usual lock animation, but locks immediately.
// Unlike StartLockAnimation it does no lead to StartShutdownAnimation.
virtual void StartLockAnimationAndLockImmediately();
// Returns true if we have requested system to lock, but haven't received
// confirmation yet.
virtual bool LockRequested();
// Returns true if we are shutting down.
virtual bool ShutdownRequested();
// Returns true if we are within cancellable lock timeframe.
virtual bool CanCancelLockAnimation();
// Cancels locking and reverts lock animation.
virtual void CancelLockAnimation();
// Cancels locking and reverts lock animation with slightly different
// parameters. Seems to be some bug, but refactoring should keep all bugs.
// TODO(antrim): remove this, animations should actually be the same.
virtual void CancelLockWithOtherAnimation();
// Returns true if we are within cancellable shutdown timeframe.
virtual bool CanCancelShutdownAnimation();
// Cancels shutting down and reverts shutdown animation.
virtual void CancelShutdownAnimation();
// Called when Chrome gets a request to display the lock screen.
virtual void OnStartingLock();
// Displays the shutdown animation and requests shutdown when it's done.
virtual void RequestShutdown();
protected:
friend class test::PowerButtonControllerTest;
bool IsLoggedInAsNonGuest() const;
private:
void RequestShutdownImpl();
// Starts lock timer.
void StartLockTimer();
// Requests that the screen be locked and starts |lock_fail_timer_|.
void OnLockTimeout();
// Reverts the pre-lock animation, reports the error.
void OnLockFailTimeout();
// Starts timer for gap between lock and shutdown.
void StartLockToShutdownTimer();
// Calls StartShutdownAnimation().
void OnLockToShutdownTimeout();
// Starts timer for undoable shutdown animation.
void StartPreShutdownAnimationTimer();
// Calls RequestShutdownImpl();
void OnPreShutdownAnimationTimeout();
// Starts timer for final shutdown animation.
void StartRealShutdownTimer();
// Requests that the machine be shut down.
void OnRealShutdownTimeout();
// The current login status.
user::LoginStatus login_status_;
// Original login status from before we locked. LOGGED_IN_NONE if it's not
// locked.
user::LoginStatus unlocked_login_status_;
// Are we in the process of shutting the machine down?
bool shutting_down_;
// Indicates whether controller should proceed to (cancellable) shutdown after
// locking.
bool shutdown_after_lock_;
// Started when the user first presses the power button while in a
// logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the
// screen.
base::OneShotTimer<SessionStateController> lock_timer_;
// Started when we request that the screen be locked. When it fires, we
// assume that our request got dropped.
base::OneShotTimer<SessionStateController> lock_fail_timer_;
// Started when the screen is locked while the power button is held. Adds a
// delay between the appearance of the lock screen and the beginning of the
// pre-shutdown animation.
base::OneShotTimer<SessionStateController> lock_to_shutdown_timer_;
// Started when we begin displaying the pre-shutdown animation. When it
// fires, we start the shutdown animation and get ready to request shutdown.
base::OneShotTimer<SessionStateController> pre_shutdown_timer_;
// Started when we display the shutdown animation. When it fires, we actually
// request shutdown. Gives the animation time to complete before Chrome, X,
// etc. are shut down.
base::OneShotTimer<SessionStateController> real_shutdown_timer_;
scoped_ptr<internal::SessionStateAnimator> animator_;
scoped_ptr<SessionStateControllerDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(SessionStateController);
};
} // namespace ash
#endif // ASH_WM_SESSION_STATE_CONTROLLER_H_
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
#include "chrome/browser/chromeos/power/brightness_observer.h" #include "chrome/browser/chromeos/power/brightness_observer.h"
#include "chrome/browser/chromeos/power/output_observer.h" #include "chrome/browser/chromeos/power/output_observer.h"
#include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeos.h"
#include "chrome/browser/chromeos/power/power_button_observer.h" #include "chrome/browser/chromeos/power/power_button_observer.h"
#include "chrome/browser/chromeos/power/resume_observer.h" #include "chrome/browser/chromeos/power/resume_observer.h"
#include "chrome/browser/chromeos/power/screen_dimming_observer.h" #include "chrome/browser/chromeos/power/screen_dimming_observer.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/chromeos/power/session_state_controller_delegate_chromeos.h" #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeos.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace chromeos { namespace chromeos {
void SessionStateControllerDelegateChromeos::RequestLockScreen() { void PowerButtonControllerDelegateChromeos::RequestLockScreen() {
// If KioskMode is enabled, if the user attempts to lock the screen via // If KioskMode is enabled, if the user attempts to lock the screen via
// the power button, we instead want to log the user out. This seemed to // the power button, we instead want to log the user out. This seemed to
// be the most acceptable replacement for the lock action of the power // be the most acceptable replacement for the lock action of the power
...@@ -26,7 +26,7 @@ void SessionStateControllerDelegateChromeos::RequestLockScreen() { ...@@ -26,7 +26,7 @@ void SessionStateControllerDelegateChromeos::RequestLockScreen() {
DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen();
} }
void SessionStateControllerDelegateChromeos::RequestShutdown() { void PowerButtonControllerDelegateChromeos::RequestShutdown() {
DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown();
} }
......
...@@ -2,29 +2,29 @@ ...@@ -2,29 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_POWER_SESSION_STATE_CONTROLLER_DELEGATE_CHROMEOS_H_ #ifndef CHROME_BROWSER_CHROMEOS_POWER_POWER_BUTTON_CONTROLLER_DELEGATE_CHROMEOS_H_
#define CHROME_BROWSER_CHROMEOS_POWER_SESSION_STATE_CONTROLLER_DELEGATE_CHROMEOS_H_ #define CHROME_BROWSER_CHROMEOS_POWER_POWER_BUTTON_CONTROLLER_DELEGATE_CHROMEOS_H_
#include "ash/wm/session_state_controller.h" #include "ash/wm/power_button_controller.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
namespace chromeos { namespace chromeos {
class SessionStateControllerDelegateChromeos class PowerButtonControllerDelegateChromeos
: public ash::SessionStateControllerDelegate { : public ash::PowerButtonControllerDelegate {
public: public:
SessionStateControllerDelegateChromeos() {} PowerButtonControllerDelegateChromeos() {}
virtual ~SessionStateControllerDelegateChromeos() {} virtual ~PowerButtonControllerDelegateChromeos() {}
private: private:
// SessionStateControllerDelegate implementation. // PowerButtonControllerDelegate implementation.
virtual void RequestLockScreen() OVERRIDE; virtual void RequestLockScreen() OVERRIDE;
virtual void RequestShutdown() OVERRIDE; virtual void RequestShutdown() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(SessionStateControllerDelegateChromeos); DISALLOW_COPY_AND_ASSIGN(PowerButtonControllerDelegateChromeos);
}; };
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_POWER_SESSION_STATE_CONTROLLER_DELEGATE_CHROMEOS_H_ #endif // CHROME_BROWSER_CHROMEOS_POWER_POWER_BUTTON_CONTROLLER_DELEGATE_CHROMEOS_H_
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "chrome/browser/chromeos/login/screen_locker.h" #include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user.h" #include "chrome/browser/chromeos/login/user.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/power/session_state_controller_delegate_chromeos.h" #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeos.h"
#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_notification_types.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
...@@ -34,8 +34,8 @@ ash::user::LoginStatus GetCurrentLoginStatus() { ...@@ -34,8 +34,8 @@ ash::user::LoginStatus GetCurrentLoginStatus() {
} // namespace } // namespace
PowerButtonObserver::PowerButtonObserver() { PowerButtonObserver::PowerButtonObserver() {
ash::Shell::GetInstance()->session_state_controller()-> ash::Shell::GetInstance()->power_button_controller()->
SetDelegate(new SessionStateControllerDelegateChromeos); set_delegate(new PowerButtonControllerDelegateChromeos);
registrar_.Add( registrar_.Add(
this, this,
...@@ -100,7 +100,7 @@ void PowerButtonObserver::LockButtonStateChanged( ...@@ -100,7 +100,7 @@ void PowerButtonObserver::LockButtonStateChanged(
} }
void PowerButtonObserver::LockScreen() { void PowerButtonObserver::LockScreen() {
ash::Shell::GetInstance()->session_state_controller()->OnStartingLock(); ash::Shell::GetInstance()->power_button_controller()->OnStartingLock();
} }
} // namespace chromeos } // namespace chromeos
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#if defined(USE_AURA) #if defined(USE_AURA)
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/session_state_controller.h" #include "ash/wm/power_button_controller.h"
#endif #endif
using content::BrowserThread; using content::BrowserThread;
...@@ -626,7 +626,7 @@ void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) { ...@@ -626,7 +626,7 @@ void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) {
void SigninScreenHandler::HandleShutdownSystem(const base::ListValue* args) { void SigninScreenHandler::HandleShutdownSystem(const base::ListValue* args) {
#if defined(USE_AURA) #if defined(USE_AURA)
// Display the shutdown animation before actually requesting shutdown. // Display the shutdown animation before actually requesting shutdown.
ash::Shell::GetInstance()->session_state_controller()->RequestShutdown(); ash::Shell::GetInstance()->power_button_controller()->RequestShutdown();
#else #else
DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown();
#endif #endif
......
...@@ -535,6 +535,8 @@ ...@@ -535,6 +535,8 @@
'browser/chromeos/power/brightness_observer.h', 'browser/chromeos/power/brightness_observer.h',
'browser/chromeos/power/output_observer.cc', 'browser/chromeos/power/output_observer.cc',
'browser/chromeos/power/output_observer.h', 'browser/chromeos/power/output_observer.h',
'browser/chromeos/power/power_button_controller_delegate_chromeos.cc',
'browser/chromeos/power/power_button_controller_delegate_chromeos.h',
'browser/chromeos/power/power_button_observer.cc', 'browser/chromeos/power/power_button_observer.cc',
'browser/chromeos/power/power_button_observer.h', 'browser/chromeos/power/power_button_observer.h',
'browser/chromeos/power/resume_observer.cc', 'browser/chromeos/power/resume_observer.cc',
...@@ -543,8 +545,6 @@ ...@@ -543,8 +545,6 @@
'browser/chromeos/power/screen_dimming_observer.h', 'browser/chromeos/power/screen_dimming_observer.h',
'browser/chromeos/power/screen_lock_observer.cc', 'browser/chromeos/power/screen_lock_observer.cc',
'browser/chromeos/power/screen_lock_observer.h', 'browser/chromeos/power/screen_lock_observer.h',
'browser/chromeos/power/session_state_controller_delegate_chromeos.cc',
'browser/chromeos/power/session_state_controller_delegate_chromeos.h',
'browser/chromeos/power/user_activity_notifier.cc', 'browser/chromeos/power/user_activity_notifier.cc',
'browser/chromeos/power/user_activity_notifier.h', 'browser/chromeos/power/user_activity_notifier.h',
'browser/chromeos/power/video_activity_notifier.cc', 'browser/chromeos/power/video_activity_notifier.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment