OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ash/shell/shell_delegate_impl.h" | 5 #include "ash/shell/shell_delegate_impl.h" |
6 | 6 |
7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
8 #include "ash/common/default_accessibility_delegate.h" | 8 #include "ash/common/default_accessibility_delegate.h" |
9 #include "ash/common/gpu_support_stub.h" | 9 #include "ash/common/gpu_support_stub.h" |
10 #include "ash/common/palette_delegate.h" | 10 #include "ash/common/palette_delegate.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 done.Run(); | 52 done.Run(); |
53 } | 53 } |
54 void CancelPartialScreenshot() override {} | 54 void CancelPartialScreenshot() override {} |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl); | 57 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl); |
58 }; | 58 }; |
59 | 59 |
60 class SessionStateDelegateImpl : public SessionStateDelegate { | 60 class SessionStateDelegateImpl : public SessionStateDelegate { |
61 public: | 61 public: |
62 SessionStateDelegateImpl() | 62 SessionStateDelegateImpl() : user_info_(new user_manager::UserInfoImpl()) {} |
63 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} | |
64 | 63 |
65 ~SessionStateDelegateImpl() override {} | 64 ~SessionStateDelegateImpl() override {} |
66 | 65 |
67 // SessionStateDelegate: | 66 // SessionStateDelegate: |
68 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } | |
69 int NumberOfLoggedInUsers() const override { | |
70 // ash_shell has 2 users. | |
71 return 2; | |
72 } | |
73 bool IsActiveUserSessionStarted() const override { return true; } | |
74 bool CanLockScreen() const override { return true; } | |
75 bool IsScreenLocked() const override { return screen_locked_; } | |
76 bool ShouldLockScreenAutomatically() const override { return false; } | |
77 void LockScreen() override { | |
78 shell::CreateLockScreen(); | |
79 screen_locked_ = true; | |
80 Shell::GetInstance()->UpdateShelfVisibility(); | |
81 } | |
82 void UnlockScreen() override { | |
83 screen_locked_ = false; | |
84 Shell::GetInstance()->UpdateShelfVisibility(); | |
85 } | |
86 bool IsUserSessionBlocked() const override { | |
87 return !IsActiveUserSessionStarted() || IsScreenLocked(); | |
88 } | |
89 session_manager::SessionState GetSessionState() const override { | |
90 // Assume that if session is not active we're at login. | |
91 return IsActiveUserSessionStarted() | |
92 ? session_manager::SessionState::ACTIVE | |
93 : session_manager::SessionState::LOGIN_PRIMARY; | |
94 } | |
95 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override { | |
96 return user_info_.get(); | |
97 } | |
98 bool ShouldShowAvatar(WmWindow* window) const override { | 67 bool ShouldShowAvatar(WmWindow* window) const override { |
99 return !user_info_->GetImage().isNull(); | 68 return !user_info_->GetImage().isNull(); |
100 } | 69 } |
101 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { | 70 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { |
102 return gfx::ImageSkia(); | 71 return gfx::ImageSkia(); |
103 } | 72 } |
104 void SwitchActiveUser(const AccountId& account_id) override {} | |
105 void CycleActiveUser(CycleUserDirection direction) override {} | |
106 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { | |
107 return true; | |
108 } | |
109 void AddSessionStateObserver(SessionStateObserver* observer) override {} | |
110 void RemoveSessionStateObserver(SessionStateObserver* observer) override {} | |
111 | 73 |
112 private: | 74 private: |
113 bool screen_locked_; | |
114 | |
115 // A pseudo user info. | 75 // A pseudo user info. |
116 std::unique_ptr<user_manager::UserInfo> user_info_; | 76 std::unique_ptr<user_manager::UserInfo> user_info_; |
117 | 77 |
118 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); | 78 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); |
119 }; | 79 }; |
120 | 80 |
121 } // namespace | 81 } // namespace |
122 | 82 |
123 ShellDelegateImpl::ShellDelegateImpl() {} | 83 ShellDelegateImpl::ShellDelegateImpl() {} |
124 | 84 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return true; | 170 return true; |
211 } | 171 } |
212 | 172 |
213 void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled, | 173 void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled, |
214 bool use_local_state) {} | 174 bool use_local_state) {} |
215 | 175 |
216 void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {} | 176 void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {} |
217 | 177 |
218 } // namespace shell | 178 } // namespace shell |
219 } // namespace ash | 179 } // namespace ash |
OLD | NEW |