OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef ASH_SHELF_SHELF_LOCKING_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_LOCKING_MANAGER_H_ |
6 #define ASH_SHELF_SHELF_LOCKING_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_LOCKING_MANAGER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/public/cpp/shelf_types.h" | 9 #include "ash/public/cpp/shelf_types.h" |
10 #include "ash/session/session_observer.h" | 10 #include "ash/session/session_observer.h" |
11 #include "ash/wm/lock_state_observer.h" | 11 #include "ash/wm/lock_state_observer.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 class WmShelf; | 15 class Shelf; |
16 | 16 |
17 // ShelfLockingManager observes screen and session events to align the shelf at | 17 // ShelfLockingManager observes screen and session events to align the shelf at |
18 // the bottom of the screen when the screen is locked. | 18 // the bottom of the screen when the screen is locked. |
19 class ASH_EXPORT ShelfLockingManager : public SessionObserver, | 19 class ASH_EXPORT ShelfLockingManager : public SessionObserver, |
20 public LockStateObserver { | 20 public LockStateObserver { |
21 public: | 21 public: |
22 explicit ShelfLockingManager(WmShelf* shelf); | 22 explicit ShelfLockingManager(Shelf* shelf); |
23 ~ShelfLockingManager() override; | 23 ~ShelfLockingManager() override; |
24 | 24 |
25 bool is_locked() const { return session_locked_ || screen_locked_; } | 25 bool is_locked() const { return session_locked_ || screen_locked_; } |
26 void set_stored_alignment(ShelfAlignment value) { stored_alignment_ = value; } | 26 void set_stored_alignment(ShelfAlignment value) { stored_alignment_ = value; } |
27 | 27 |
28 // SessionObserver: | 28 // SessionObserver: |
29 void OnLockStateChanged(bool locked) override; | 29 void OnLockStateChanged(bool locked) override; |
30 void OnSessionStateChanged(session_manager::SessionState state) override; | 30 void OnSessionStateChanged(session_manager::SessionState state) override; |
31 | 31 |
32 // LockStateObserver: | 32 // LockStateObserver: |
33 void OnLockStateEvent(EventType event) override; | 33 void OnLockStateEvent(EventType event) override; |
34 | 34 |
35 private: | 35 private: |
36 // Update the shelf state for session and screen lock changes. | 36 // Update the shelf state for session and screen lock changes. |
37 void UpdateLockedState(); | 37 void UpdateLockedState(); |
38 | 38 |
39 WmShelf* shelf_; | 39 Shelf* shelf_; |
40 bool session_locked_ = false; | 40 bool session_locked_ = false; |
41 bool screen_locked_ = false; | 41 bool screen_locked_ = false; |
42 ShelfAlignment stored_alignment_; | 42 ShelfAlignment stored_alignment_; |
43 | 43 |
44 ScopedSessionObserver scoped_session_observer_; | 44 ScopedSessionObserver scoped_session_observer_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(ShelfLockingManager); | 46 DISALLOW_COPY_AND_ASSIGN(ShelfLockingManager); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace ash | 49 } // namespace ash |
50 | 50 |
51 #endif // ASH_SHELF_SHELF_LOCKING_MANAGER_H_ | 51 #endif // ASH_SHELF_SHELF_LOCKING_MANAGER_H_ |
OLD | NEW |