Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2678)

Unified Diff: ash/wm/session_state_controller_impl.h

Issue 11230050: ash : introduce second SessionStateController implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge with TOT, review fixes Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/session_state_controller.cc ('k') | ash/wm/session_state_controller_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/session_state_controller_impl.h
diff --git a/ash/wm/session_state_controller.h b/ash/wm/session_state_controller_impl.h
similarity index 58%
copy from ash/wm/session_state_controller.h
copy to ash/wm/session_state_controller_impl.h
index 47dbd9b598db2d1850361cbbfa26c0058ccee4ac..8d53d7ba5bbf46833d62a280233390160ead9dd8 100644
--- a/ash/wm/session_state_controller.h
+++ b/ash/wm/session_state_controller_impl.h
@@ -2,12 +2,13 @@
// 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_
+#ifndef ASH_WM_SESSION_STATE_CONTROLLER_IMPL_H_
+#define ASH_WM_SESSION_STATE_CONTROLLER_IMPL_H_
#include "ash/ash_export.h"
#include "ash/shell_observer.h"
#include "ash/wm/session_state_animator.h"
+#include "ash/wm/session_state_controller.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
@@ -29,63 +30,15 @@ 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 {
+class ASH_EXPORT SessionStateControllerImpl : public SessionStateController {
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);
+ explicit TestApi(SessionStateControllerImpl* controller);
virtual ~TestApi();
@@ -126,13 +79,13 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
controller_->real_shutdown_timer_.Stop();
}
private:
- SessionStateController* controller_; // not owned
+ SessionStateControllerImpl* controller_; // not owned
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
- SessionStateController();
- virtual ~SessionStateController();
+ SessionStateControllerImpl();
+ virtual ~SessionStateControllerImpl();
// RootWindowObserver override:
virtual void OnRootWindowHostCloseRequested(
@@ -143,56 +96,49 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
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();
+ virtual bool IsEligibleForLock() OVERRIDE;
// Returns true if system is locked.
- virtual bool IsLocked();
+ virtual bool IsLocked() OVERRIDE;
// Starts locking (with slow animation) that can be cancelled.
// After locking and |kLockToShutdownTimeoutMs| StartShutdownAnimation()
- // will be called unless CancelShutdown() is called, if |shutdown_after_lock|
- // is true.
- virtual void StartLockAnimation(bool shutdown_after_lock);
+ // will be called unless CancelShutdownAnimation() is called, if
+ // shutdown_after_lock is true.
+ virtual void StartLockAnimation(bool shutdown_after_lock) OVERRIDE;
// Starts shutting down (with slow animation) that can be cancelled.
- virtual void StartShutdownAnimation();
+ virtual void StartShutdownAnimation() OVERRIDE;
// Starts usual lock animation, but locks immediately.
// Unlike StartLockAnimation it does no lead to StartShutdownAnimation.
- virtual void StartLockAnimationAndLockImmediately();
+ virtual void StartLockAnimationAndLockImmediately() OVERRIDE;
// Returns true if we have requested system to lock, but haven't received
// confirmation yet.
- virtual bool LockRequested();
+ virtual bool LockRequested() OVERRIDE;
// Returns true if we are shutting down.
- virtual bool ShutdownRequested();
+ virtual bool ShutdownRequested() OVERRIDE;
// Returns true if we are within cancellable lock timeframe.
- virtual bool CanCancelLockAnimation();
+ virtual bool CanCancelLockAnimation() OVERRIDE;
// 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();
+ virtual void CancelLockAnimation() OVERRIDE;
// Returns true if we are within cancellable shutdown timeframe.
- virtual bool CanCancelShutdownAnimation();
+ virtual bool CanCancelShutdownAnimation() OVERRIDE;
// Cancels shutting down and reverts shutdown animation.
- virtual void CancelShutdownAnimation();
+ virtual void CancelShutdownAnimation() OVERRIDE;
// Called when Chrome gets a request to display the lock screen.
- virtual void OnStartingLock();
+ virtual void OnStartingLock() OVERRIDE;
// Displays the shutdown animation and requests shutdown when it's done.
- virtual void RequestShutdown();
+ virtual void RequestShutdown() OVERRIDE;
protected:
friend class test::PowerButtonControllerTest;
@@ -229,12 +175,11 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
// Requests that the machine be shut down.
void OnRealShutdownTimeout();
- // The current login status.
+ // The current login status, or original login status from before we locked..
user::LoginStatus login_status_;
- // Original login status from before we locked. LOGGED_IN_NONE if it's not
- // locked.
- user::LoginStatus unlocked_login_status_;
+ // Current lock status.
+ bool system_is_locked_;
// Are we in the process of shutting the machine down?
bool shutting_down_;
@@ -246,33 +191,29 @@ class ASH_EXPORT SessionStateController : public aura::RootWindowObserver,
// 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_;
+ base::OneShotTimer<SessionStateControllerImpl> 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_;
+ base::OneShotTimer<SessionStateControllerImpl> 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_;
+ base::OneShotTimer<SessionStateControllerImpl> 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_;
+ base::OneShotTimer<SessionStateControllerImpl> 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_;
+ base::OneShotTimer<SessionStateControllerImpl> real_shutdown_timer_;
- DISALLOW_COPY_AND_ASSIGN(SessionStateController);
+ DISALLOW_COPY_AND_ASSIGN(SessionStateControllerImpl);
};
} // namespace ash
-#endif // ASH_WM_SESSION_STATE_CONTROLLER_H_
+#endif // ASH_WM_SESSION_STATE_CONTROLLER_IMPL_H_
« no previous file with comments | « ash/wm/session_state_controller.cc ('k') | ash/wm/session_state_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698