summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 13:58:27 +0000
committerbartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 13:58:27 +0000
commit91545875f50bd58f48d1311355c8f0e4eef847e6 (patch)
treedcca143751c99c5434f72f3fc26fe7371dc3b257 /ash
parent125d7dcd64991fa580bcd9cb98e43e9baa28f670 (diff)
downloadchromium_src-91545875f50bd58f48d1311355c8f0e4eef847e6.zip
chromium_src-91545875f50bd58f48d1311355c8f0e4eef847e6.tar.gz
chromium_src-91545875f50bd58f48d1311355c8f0e4eef847e6.tar.bz2
Let chromeos::User decide whether the current session can be locked
We have several different methods that try to determine whether the current session can be locked. This redundancy is difficult to maintain and has drifted out of sync in the past. The CL consolidates all checks and makes the chromeos::User class the autoritative source for whether the current session can be locked or not. BUG=152928 Review URL: https://chromiumcodereview.appspot.com/11412100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell.cc6
-rw-r--r--ash/shell.h4
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h1
-rw-r--r--ash/shell_delegate.h4
-rw-r--r--ash/system/date/tray_date.cc18
-rw-r--r--ash/test/ash_test_base.cc4
-rw-r--r--ash/test/ash_test_base.h5
-rw-r--r--ash/test/test_shell_delegate.cc9
-rw-r--r--ash/test/test_shell_delegate.h6
-rw-r--r--ash/wm/power_button_controller.cc20
-rw-r--r--ash/wm/power_button_controller_unittest.cc23
-rw-r--r--ash/wm/session_state_controller.h8
-rw-r--r--ash/wm/session_state_controller_impl.cc16
-rw-r--r--ash/wm/session_state_controller_impl.h4
-rw-r--r--ash/wm/session_state_controller_impl2.cc16
-rw-r--r--ash/wm/session_state_controller_impl2.h4
17 files changed, 83 insertions, 69 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index f27c16c..9ef82e9 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -14,8 +14,8 @@
#include "ash/desktop_background/desktop_background_view.h"
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/display/display_controller.h"
-#include "ash/display/mouse_cursor_event_filter.h"
#include "ash/display/display_manager.h"
+#include "ash/display/mouse_cursor_event_filter.h"
#include "ash/display/screen_position_controller.h"
#include "ash/drag_drop/drag_drop_controller.h"
#include "ash/focus_cycler.h"
@@ -587,6 +587,10 @@ aura::Window* Shell::GetAppListWindow() {
return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL;
}
+bool Shell::CanLockScreen() {
+ return delegate_->CanLockScreen();
+}
+
bool Shell::IsScreenLocked() const {
return delegate_->IsScreenLocked();
}
diff --git a/ash/shell.h b/ash/shell.h
index db4b5c0..c0be77b 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -210,6 +210,10 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate,
// Returns app list window or NULL if it is not visible.
aura::Window* GetAppListWindow();
+ // Returns true if a user is logged in whose session can be locked (i.e. the
+ // user has a password with which to unlock the session).
+ bool CanLockScreen();
+
// Returns true if the screen is locked.
bool IsScreenLocked() const;
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 4f0f022..42311ca 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -46,6 +46,10 @@ bool ShellDelegateImpl::IsFirstRunAfterBoot() {
return false;
}
+bool ShellDelegateImpl::CanLockScreen() {
+ return true;
+}
+
void ShellDelegateImpl::LockScreen() {
ash::shell::CreateLockScreen();
locked_ = true;
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 6f55237..9e34aff 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -24,6 +24,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual bool IsUserLoggedIn() OVERRIDE;
virtual bool IsSessionStarted() OVERRIDE;
virtual bool IsFirstRunAfterBoot() OVERRIDE;
+ virtual bool CanLockScreen() OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
virtual bool IsScreenLocked() const OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index 6f3c7f3..3c5d433 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -76,6 +76,10 @@ class ASH_EXPORT ShellDelegate {
// restarted, typically due to logging in as a guest or logging out.
virtual bool IsFirstRunAfterBoot() = 0;
+ // Returns true if a user is logged in whose session can be locked (i.e. the
+ // user has a password with which to unlock the session).
+ virtual bool CanLockScreen() = 0;
+
// Invoked when a user locks the screen.
virtual void LockScreen() = 0;
diff --git a/ash/system/date/tray_date.cc b/ash/system/date/tray_date.cc
index 46033d0..2b5b266 100644
--- a/ash/system/date/tray_date.cc
+++ b/ash/system/date/tray_date.cc
@@ -82,16 +82,16 @@ class DateDefaultView : public views::View,
IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER,
IDS_ASH_STATUS_TRAY_SHUTDOWN);
view->AddButton(shutdown_);
+ }
- if (login != ash::user::LOGGED_IN_GUEST) {
- lock_ = new ash::internal::TrayPopupHeaderButton(this,
- IDR_AURA_UBER_TRAY_LOCKSCREEN,
- IDR_AURA_UBER_TRAY_LOCKSCREEN,
- IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER,
- IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER,
- IDS_ASH_STATUS_TRAY_LOCK);
- view->AddButton(lock_);
- }
+ if (ash::Shell::GetInstance()->CanLockScreen()) {
+ lock_ = new ash::internal::TrayPopupHeaderButton(this,
+ IDR_AURA_UBER_TRAY_LOCKSCREEN,
+ IDR_AURA_UBER_TRAY_LOCKSCREEN,
+ IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER,
+ IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER,
+ IDS_ASH_STATUS_TRAY_LOCK);
+ view->AddButton(lock_);
}
}
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index eaa2288..dc9590f 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -94,5 +94,9 @@ void AshTestBase::SetUserLoggedIn(bool user_logged_in) {
test_shell_delegate_->SetUserLoggedIn(user_logged_in);
}
+void AshTestBase::SetCanLockScreen(bool can_lock_screen) {
+ test_shell_delegate_->SetCanLockScreen(can_lock_screen);
+}
+
} // namespace test
} // namespace ash
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index e21225a..0865f39 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -52,10 +52,11 @@ class AshTestBase : public testing::Test {
protected:
void RunAllPendingInMessageLoop();
- // Utility methods to emulate user logged in or not and
- // session started or not cases.
+ // Utility methods to emulate user logged in or not, session started or not
+ // and user able to lock screen or not cases.
void SetSessionStarted(bool session_started);
void SetUserLoggedIn(bool user_logged_in);
+ void SetCanLockScreen(bool can_lock_screen);
private:
MessageLoopForUI message_loop_;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index e406d76..0f81bde 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -23,6 +23,7 @@ TestShellDelegate::TestShellDelegate()
session_started_(true),
spoken_feedback_enabled_(false),
user_logged_in_(true),
+ can_lock_screen_(true),
num_exit_requests_(0) {
}
@@ -41,6 +42,10 @@ bool TestShellDelegate::IsFirstRunAfterBoot() {
return false;
}
+bool TestShellDelegate::CanLockScreen() {
+ return user_logged_in_ && can_lock_screen_;
+}
+
void TestShellDelegate::LockScreen() {
locked_ = true;
}
@@ -178,5 +183,9 @@ void TestShellDelegate::SetUserLoggedIn(bool user_logged_in) {
session_started_ = false;
}
+void TestShellDelegate::SetCanLockScreen(bool can_lock_screen) {
+ can_lock_screen_ = can_lock_screen;
+}
+
} // namespace test
} // namespace ash
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index f96c370..b8f3ead 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -24,6 +24,7 @@ class TestShellDelegate : public ShellDelegate {
virtual bool IsSessionStarted() OVERRIDE;
virtual bool IsFirstRunAfterBoot() OVERRIDE;
virtual void LockScreen() OVERRIDE;
+ virtual bool CanLockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
virtual bool IsScreenLocked() const OVERRIDE;
virtual void Shutdown() OVERRIDE;
@@ -77,10 +78,15 @@ class TestShellDelegate : public ShellDelegate {
// hasn't been started too.
void SetUserLoggedIn(bool user_logged_in);
+ // Sets the internal state that indicates whether the user can lock the
+ // screen.
+ void SetCanLockScreen(bool can_lock_screen);
+
bool locked_;
bool session_started_;
bool spoken_feedback_enabled_;
bool user_logged_in_;
+ bool can_lock_screen_;
int num_exit_requests_;
scoped_ptr<content::BrowserContext> current_browser_context_;
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc
index 21432ed..9359b8a 100644
--- a/ash/wm/power_button_controller.cc
+++ b/ash/wm/power_button_controller.cc
@@ -45,15 +45,18 @@ void PowerButtonController::OnPowerButtonEvent(
if (screen_is_off_)
return;
+ Shell* shell = Shell::GetInstance();
if (has_legacy_power_button_) {
// If power button releases won't get reported correctly because we're not
// running on official hardware, just lock the screen or shut down
// immediately.
if (down) {
- if (controller_->IsEligibleForLock())
+ if (shell->CanLockScreen() && !shell->IsScreenLocked() &&
+ !controller_->LockRequested()) {
controller_->StartLockAnimationAndLockImmediately();
- else
+ } else {
controller_->RequestShutdown();
+ }
}
} else { // !has_legacy_power_button_
if (down) {
@@ -61,7 +64,7 @@ void PowerButtonController::OnPowerButtonEvent(
if (controller_->LockRequested())
return;
- if (controller_->IsEligibleForLock())
+ if (shell->CanLockScreen() && !shell->IsScreenLocked())
controller_->StartLockAnimation(true);
else
controller_->StartShutdownAnimation();
@@ -78,19 +81,18 @@ void PowerButtonController::OnLockButtonEvent(
bool down, const base::TimeTicks& timestamp) {
lock_button_down_ = down;
- if (controller_->ShutdownRequested() || !controller_->IsEligibleForLock())
+ Shell* shell = Shell::GetInstance();
+ if (!shell->CanLockScreen() || shell->IsScreenLocked() ||
+ controller_->LockRequested() || controller_->ShutdownRequested()) {
return;
+ }
- // Bail if we're already locked or are in the process of locking. Also give
- // the power button precedence over the lock button (we don't expect both
+ // Give the power button precedence over the lock button (we don't expect both
// buttons to be present, so this is just making sure that we don't do
// something completely stupid if that assumption changes later).
if (power_button_down_)
return;
- if (controller_->IsLocked() || controller_->LockRequested())
- return;
-
if (down)
controller_->StartLockAnimation(false);
else
diff --git a/ash/wm/power_button_controller_unittest.cc b/ash/wm/power_button_controller_unittest.cc
index 6d81f39..7cf0a4e 100644
--- a/ash/wm/power_button_controller_unittest.cc
+++ b/ash/wm/power_button_controller_unittest.cc
@@ -74,6 +74,8 @@ class PowerButtonControllerTest : public AshTestBase {
animator_api_.reset(
new internal::SessionStateAnimator::TestApi(state_controller_->
animator_.get()));
+ shell_delegate_ = reinterpret_cast<TestShellDelegate*>(
+ ash::Shell::GetInstance()->delegate());
}
protected:
@@ -85,13 +87,13 @@ class PowerButtonControllerTest : public AshTestBase {
int NumShutdownRequests() {
return delegate_->num_shutdown_requests() +
- reinterpret_cast<TestShellDelegate*>(
- ash::Shell::GetInstance()->delegate())->num_exit_requests();
+ shell_delegate_->num_exit_requests();
}
PowerButtonController* controller_; // not owned
SessionStateControllerImpl* state_controller_; // not owned
TestPowerButtonControllerDelegate* delegate_; // not owned
+ TestShellDelegate* shell_delegate_; // not owned
scoped_ptr<SessionStateControllerImpl::TestApi> test_api_;
scoped_ptr<internal::SessionStateAnimator::TestApi> animator_api_;
@@ -136,6 +138,7 @@ TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
// Notify that the lock window is visible. We should make it fade in.
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
@@ -177,6 +180,7 @@ TEST_F(PowerButtonControllerTest, LegacyNotLoggedIn) {
controller_->set_has_legacy_power_button_for_test(true);
state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
state_controller_->OnLockStateChanged(false);
+ SetUserLoggedIn(false);
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
}
@@ -187,6 +191,7 @@ TEST_F(PowerButtonControllerTest, LegacyGuest) {
controller_->set_has_legacy_power_button_for_test(true);
state_controller_->OnLoginStateChanged(user::LOGGED_IN_GUEST);
state_controller_->OnLockStateChanged(false);
+ SetCanLockScreen(false);
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
}
@@ -197,6 +202,7 @@ TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
controller_->set_has_legacy_power_button_for_test(false);
state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
state_controller_->OnLockStateChanged(false);
+ SetUserLoggedIn(false);
// Press the power button and check that we start the shutdown timer.
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
@@ -298,6 +304,7 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
// Notify that the lock window is visible. We should make it fade in.
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::kAllLockScreenContainersMask,
@@ -312,6 +319,7 @@ TEST_F(PowerButtonControllerTest, LockAndUnlock) {
// Notify that the screen has been unlocked. We should show the
// non-screen-locker windows.
state_controller_->OnLockStateChanged(false);
+ shell_delegate_->UnlockScreen();
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
internal::SessionStateAnimator::DESKTOP_BACKGROUND |
@@ -332,6 +340,7 @@ TEST_F(PowerButtonControllerTest, LockToShutdown) {
test_api_->trigger_lock_timeout();
state_controller_->OnStartingLock();
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
// When the lock-to-shutdown timeout fires, we should start the shutdown
// timer.
@@ -369,6 +378,7 @@ TEST_F(PowerButtonControllerTest, CancelLockToShutdown) {
// Power button is released while system attempts to lock.
controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
EXPECT_FALSE(state_controller_->ShutdownRequested());
EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running());
@@ -415,6 +425,7 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
// The lock button shouldn't do anything if we aren't logged in.
state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
state_controller_->OnLockStateChanged(false);
+ SetUserLoggedIn(false);
controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
EXPECT_FALSE(test_api_->lock_timer_is_running());
controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
@@ -422,6 +433,8 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
// Ditto for when we're logged in as a guest.
state_controller_->OnLoginStateChanged(user::LOGGED_IN_GUEST);
+ SetUserLoggedIn(true);
+ SetCanLockScreen(false);
controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
EXPECT_FALSE(test_api_->lock_timer_is_running());
controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
@@ -430,6 +443,7 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
// If we're logged in as a regular user, we should start the lock timer and
// the pre-lock animation.
state_controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
+ SetCanLockScreen(true);
controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
EXPECT_TRUE(test_api_->lock_timer_is_running());
EXPECT_TRUE(
@@ -463,6 +477,7 @@ TEST_F(PowerButtonControllerTest, LockButtonBasic) {
// Pressing the button also shouldn't do anything after the screen is locked.
state_controller_->OnStartingLock();
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
EXPECT_FALSE(test_api_->lock_timer_is_running());
controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
@@ -528,6 +543,8 @@ TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) {
// outside request to shut down (e.g. from the login or lock screen).
TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) {
state_controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
+ state_controller_->OnLockStateChanged(false);
+ SetUserLoggedIn(false);
state_controller_->RequestShutdown();
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
@@ -549,6 +566,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) {
TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) {
state_controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
state_controller_->RequestShutdown();
EXPECT_TRUE(
animator_api_->ContainersAreAnimated(
@@ -570,6 +588,7 @@ TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) {
TEST_F(PowerButtonControllerTest, RequestAndCancelShutdownFromLockScreen) {
state_controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
state_controller_->OnLockStateChanged(true);
+ shell_delegate_->LockScreen();
// Press the power button and check that we start the shutdown timer.
controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
diff --git a/ash/wm/session_state_controller.h b/ash/wm/session_state_controller.h
index 53e28cd..703a680 100644
--- a/ash/wm/session_state_controller.h
+++ b/ash/wm/session_state_controller.h
@@ -73,12 +73,6 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
void SetDelegate(SessionStateControllerDelegate* delegate);
- // Returns true iff when we're in state when user session can be locked.
- virtual bool IsEligibleForLock() = 0;
-
- // Returns true if system is locked.
- virtual bool IsLocked() = 0;
-
// Starts locking (with slow animation) that can be cancelled.
// After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation()
// will be called unless CancelShutdownAnimation() is called, if
@@ -129,8 +123,6 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
protected:
friend class test::PowerButtonControllerTest;
- bool IsLoggedInAsNonGuest() const;
-
scoped_ptr<internal::SessionStateAnimator> animator_;
scoped_ptr<SessionStateControllerDelegate> delegate_;
diff --git a/ash/wm/session_state_controller_impl.cc b/ash/wm/session_state_controller_impl.cc
index 9abb3b8..93b55ce 100644
--- a/ash/wm/session_state_controller_impl.cc
+++ b/ash/wm/session_state_controller_impl.cc
@@ -61,7 +61,7 @@ void SessionStateControllerImpl::OnAppTerminating() {
}
void SessionStateControllerImpl::OnLockStateChanged(bool locked) {
- if (shutting_down_ || (IsLocked()) == locked)
+ if (shutting_down_ || (system_is_locked_ == locked))
return;
system_is_locked_ = locked;
@@ -136,14 +136,6 @@ void SessionStateControllerImpl::StartShutdownAnimation() {
StartPreShutdownAnimationTimer();
}
-bool SessionStateControllerImpl::IsEligibleForLock() {
- return IsLoggedInAsNonGuest() && !IsLocked() && !LockRequested();
-}
-
-bool SessionStateControllerImpl::IsLocked() {
- return system_is_locked_;
-}
-
bool SessionStateControllerImpl::LockRequested() {
return lock_fail_timer_.IsRunning();
}
@@ -246,12 +238,6 @@ void SessionStateControllerImpl::OnRootWindowHostCloseRequested(
Shell::GetInstance()->delegate()->Exit();
}
-bool SessionStateControllerImpl::IsLoggedInAsNonGuest() const {
- // TODO(mukai): think about kiosk mode.
- return (login_status_ != user::LOGGED_IN_NONE) &&
- (login_status_ != user::LOGGED_IN_GUEST);
-}
-
void SessionStateControllerImpl::StartLockTimer() {
lock_timer_.Stop();
lock_timer_.Start(
diff --git a/ash/wm/session_state_controller_impl.h b/ash/wm/session_state_controller_impl.h
index 9c62e96..cab27b3 100644
--- a/ash/wm/session_state_controller_impl.h
+++ b/ash/wm/session_state_controller_impl.h
@@ -97,8 +97,6 @@ class ASH_EXPORT SessionStateControllerImpl : public SessionStateController {
virtual void OnLockStateChanged(bool locked) OVERRIDE;
// SessionStateController overrides:
- virtual bool IsEligibleForLock() OVERRIDE;
- virtual bool IsLocked() OVERRIDE;
virtual void StartLockAnimation(bool shutdown_after_lock) OVERRIDE;
virtual void StartShutdownAnimation() OVERRIDE;
@@ -122,8 +120,6 @@ class ASH_EXPORT SessionStateControllerImpl : public SessionStateController {
protected:
friend class test::PowerButtonControllerTest;
- bool IsLoggedInAsNonGuest() const;
-
private:
void RequestShutdownImpl();
diff --git a/ash/wm/session_state_controller_impl2.cc b/ash/wm/session_state_controller_impl2.cc
index d8c156f..0cacb44 100644
--- a/ash/wm/session_state_controller_impl2.cc
+++ b/ash/wm/session_state_controller_impl2.cc
@@ -62,7 +62,7 @@ void SessionStateControllerImpl2::OnAppTerminating() {
}
void SessionStateControllerImpl2::OnLockStateChanged(bool locked) {
- if (shutting_down_ || (IsLocked()) == locked)
+ if (shutting_down_ || (system_is_locked_ == locked))
return;
system_is_locked_ = locked;
@@ -147,14 +147,6 @@ void SessionStateControllerImpl2::StartShutdownAnimation() {
StartPreShutdownAnimationTimer();
}
-bool SessionStateControllerImpl2::IsEligibleForLock() {
- return IsLoggedInAsNonGuest() && !IsLocked() && !LockRequested();
-}
-
-bool SessionStateControllerImpl2::IsLocked() {
- return system_is_locked_;
-}
-
bool SessionStateControllerImpl2::LockRequested() {
return lock_fail_timer_.IsRunning();
}
@@ -227,12 +219,6 @@ void SessionStateControllerImpl2::OnRootWindowHostCloseRequested(
Shell::GetInstance()->delegate()->Exit();
}
-bool SessionStateControllerImpl2::IsLoggedInAsNonGuest() const {
- // TODO(mukai): think about kiosk mode.
- return (login_status_ != user::LOGGED_IN_NONE) &&
- (login_status_ != user::LOGGED_IN_GUEST);
-}
-
void SessionStateControllerImpl2::StartLockTimer() {
lock_timer_.Stop();
lock_timer_.Start(
diff --git a/ash/wm/session_state_controller_impl2.h b/ash/wm/session_state_controller_impl2.h
index 8138fd5..f8535fb 100644
--- a/ash/wm/session_state_controller_impl2.h
+++ b/ash/wm/session_state_controller_impl2.h
@@ -97,8 +97,6 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController {
virtual void OnLockStateChanged(bool locked) OVERRIDE;
// SessionStateController overrides:
- virtual bool IsEligibleForLock() OVERRIDE;
- virtual bool IsLocked() OVERRIDE;
virtual void StartLockAnimation(bool shutdown_after_lock) OVERRIDE;
virtual void StartShutdownAnimation() OVERRIDE;
@@ -122,8 +120,6 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController {
protected:
friend class test::PowerButtonControllerTest;
- bool IsLoggedInAsNonGuest() const;
-
private:
void RequestShutdownImpl();