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

Side by Side Diff: ash/common/test/test_session_state_delegate.h

Issue 2446453002: Refactor ShouldLockScreenBeforeSuspending to ShouldLockScreenAutomatically (Closed)
Patch Set: comment Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_ 5 #ifndef ASH_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_
6 #define ASH_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_ 6 #define ASH_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 void AddUser(const AccountId& account_id); 32 void AddUser(const AccountId& account_id);
33 const user_manager::UserInfo* GetActiveUserInfo() const; 33 const user_manager::UserInfo* GetActiveUserInfo() const;
34 34
35 // SessionStateDelegate: 35 // SessionStateDelegate:
36 int GetMaximumNumberOfLoggedInUsers() const override; 36 int GetMaximumNumberOfLoggedInUsers() const override;
37 int NumberOfLoggedInUsers() const override; 37 int NumberOfLoggedInUsers() const override;
38 bool IsActiveUserSessionStarted() const override; 38 bool IsActiveUserSessionStarted() const override;
39 bool CanLockScreen() const override; 39 bool CanLockScreen() const override;
40 bool IsScreenLocked() const override; 40 bool IsScreenLocked() const override;
41 bool ShouldLockScreenBeforeSuspending() const override; 41 bool ShouldLockScreenAutomatically() const override;
42 void LockScreen() override; 42 void LockScreen() override;
43 void UnlockScreen() override; 43 void UnlockScreen() override;
44 bool IsUserSessionBlocked() const override; 44 bool IsUserSessionBlocked() const override;
45 session_manager::SessionState GetSessionState() const override; 45 session_manager::SessionState GetSessionState() const override;
46 const user_manager::UserInfo* GetUserInfo( 46 const user_manager::UserInfo* GetUserInfo(
47 ash::UserIndex index) const override; 47 ash::UserIndex index) const override;
48 bool ShouldShowAvatar(WmWindow* window) const override; 48 bool ShouldShowAvatar(WmWindow* window) const override;
49 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override; 49 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override;
50 void SwitchActiveUser(const AccountId& account_id) override; 50 void SwitchActiveUser(const AccountId& account_id) override;
51 void CycleActiveUser(CycleUser cycle_user) override; 51 void CycleActiveUser(CycleUser cycle_user) override;
(...skipping 13 matching lines...) Expand all
65 // fully started for the active user. If |active_user_session_started| is 65 // fully started for the active user. If |active_user_session_started| is
66 // |true|, |has_active_user_| is set to |true| as well (see below for the 66 // |true|, |has_active_user_| is set to |true| as well (see below for the
67 // difference between these two flags). 67 // difference between these two flags).
68 void SetActiveUserSessionStarted(bool active_user_session_started); 68 void SetActiveUserSessionStarted(bool active_user_session_started);
69 69
70 // Updates the internal state that indicates whether the screen can be locked. 70 // Updates the internal state that indicates whether the screen can be locked.
71 // Locking will only actually be allowed when this value is |true| and there 71 // Locking will only actually be allowed when this value is |true| and there
72 // is an active user. 72 // is an active user.
73 static void SetCanLockScreen(bool can_lock_screen); 73 static void SetCanLockScreen(bool can_lock_screen);
74 74
75 // Updates |should_lock_screen_before_suspending_|. 75 // Updates |should_lock_screen_automatically_|.
76 void SetShouldLockScreenBeforeSuspending(bool should_lock); 76 void SetShouldLockScreenAutomatically(bool should_lock);
77 77
78 // Updates the internal state that indicates whether user adding screen is 78 // Updates the internal state that indicates whether user adding screen is
79 // running now. 79 // running now.
80 void SetUserAddingScreenRunning(bool user_adding_screen_running); 80 void SetUserAddingScreenRunning(bool user_adding_screen_running);
81 81
82 // Setting non NULL image enables avatar icon. 82 // Setting non NULL image enables avatar icon.
83 void SetUserImage(const gfx::ImageSkia& user_image); 83 void SetUserImage(const gfx::ImageSkia& user_image);
84 84
85 private: 85 private:
86 class TestUserManager; 86 class TestUserManager;
87 87
88 // Whether the screen can be locked. Locking will only actually be allowed 88 // Whether the screen can be locked. Locking will only actually be allowed
89 // when this is |true| and there is an active user. 89 // when this is |true| and there is an active user.
90 bool can_lock_screen_; 90 bool can_lock_screen_;
91 91
92 // Return value for ShouldLockScreenBeforeSuspending(). 92 // Return value for ShouldLockScreenAutomatically().
93 bool should_lock_screen_before_suspending_; 93 bool should_lock_screen_automatically_;
94 94
95 // Whether the screen is currently locked. 95 // Whether the screen is currently locked.
96 bool screen_locked_; 96 bool screen_locked_;
97 97
98 // Whether user addding screen is running now. 98 // Whether user addding screen is running now.
99 bool user_adding_screen_running_; 99 bool user_adding_screen_running_;
100 100
101 // The number of users logged in. 101 // The number of users logged in.
102 int logged_in_users_; 102 int logged_in_users_;
103 103
104 // The index for the activated user. 104 // The index for the activated user.
105 int active_user_index_; 105 int active_user_index_;
106 106
107 std::vector<std::unique_ptr<MockUserInfo>> user_list_; 107 std::vector<std::unique_ptr<MockUserInfo>> user_list_;
108 108
109 // The user manager to be used instead of the system instance. 109 // The user manager to be used instead of the system instance.
110 std::unique_ptr<TestUserManager> user_manager_; 110 std::unique_ptr<TestUserManager> user_manager_;
111 111
112 // The current state of the login screen. |session_state_| becomes active 112 // The current state of the login screen. |session_state_| becomes active
113 // before the profile and browser UI are available. 113 // before the profile and browser UI are available.
114 session_manager::SessionState session_state_; 114 session_manager::SessionState session_state_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate); 116 DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate);
117 }; 117 };
118 118
119 } // namespace test 119 } // namespace test
120 } // namespace ash 120 } // namespace ash
121 121
122 #endif // ASH_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_ 122 #endif // ASH_COMMON_TEST_TEST_SESSION_STATE_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/common/session/session_state_delegate.h ('k') | ash/common/test/test_session_state_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698