OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/lock/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/login/ui/lock_screen.h" | 10 #include "ash/login/ui/lock_screen.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" | 35 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
36 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 36 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
37 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 37 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
38 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 38 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
39 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
40 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 40 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
41 #include "chrome/browser/lifetime/application_lifetime.h" | 41 #include "chrome/browser/lifetime/application_lifetime.h" |
42 #include "chrome/browser/signin/easy_unlock_service.h" | 42 #include "chrome/browser/signin/easy_unlock_service.h" |
43 #include "chrome/browser/signin/signin_manager_factory.h" | 43 #include "chrome/browser/signin/signin_manager_factory.h" |
44 #include "chrome/browser/ui/ash/ash_util.h" | 44 #include "chrome/browser/ui/ash/ash_util.h" |
| 45 #include "chrome/browser/ui/ash/lock_screen_client.h" |
45 #include "chrome/browser/ui/ash/session_controller_client.h" | 46 #include "chrome/browser/ui/ash/session_controller_client.h" |
46 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" | 47 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" |
47 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" | 48 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" |
48 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
49 #include "chrome/grit/browser_resources.h" | 50 #include "chrome/grit/browser_resources.h" |
50 #include "chrome/grit/generated_resources.h" | 51 #include "chrome/grit/generated_resources.h" |
51 #include "chromeos/audio/chromeos_sounds.h" | 52 #include "chromeos/audio/chromeos_sounds.h" |
52 #include "chromeos/chromeos_switches.h" | 53 #include "chromeos/chromeos_switches.h" |
53 #include "chromeos/dbus/biod/constants.pb.h" | 54 #include "chromeos/dbus/biod/constants.pb.h" |
54 #include "chromeos/dbus/dbus_thread_manager.h" | 55 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 160 } |
160 | 161 |
161 private: | 162 private: |
162 bool session_started_; | 163 bool session_started_; |
163 content::NotificationRegistrar registrar_; | 164 content::NotificationRegistrar registrar_; |
164 | 165 |
165 DISALLOW_COPY_AND_ASSIGN(ScreenLockObserver); | 166 DISALLOW_COPY_AND_ASSIGN(ScreenLockObserver); |
166 }; | 167 }; |
167 | 168 |
168 // Stubbed delegate that will eventually be replaced by mojo calls. | 169 // Stubbed delegate that will eventually be replaced by mojo calls. |
169 class StubDelegate : public ScreenLocker::Delegate { | 170 class MojoDelegate : public ScreenLocker::Delegate { |
170 public: | 171 public: |
171 StubDelegate() = default; | 172 MojoDelegate() = default; |
172 ~StubDelegate() override = default; | 173 ~MojoDelegate() override = default; |
173 | 174 |
174 // ScreenLocker::Delegate: | 175 // ScreenLocker::Delegate: |
175 void SetPasswordInputEnabled(bool enabled) override { NOTIMPLEMENTED(); } | 176 void SetPasswordInputEnabled(bool enabled) override { NOTIMPLEMENTED(); } |
176 void ShowErrorMessage(int error_msg_id, | 177 void ShowErrorMessage(int error_msg_id, |
177 HelpAppLauncher::HelpTopic help_topic_id) override { | 178 HelpAppLauncher::HelpTopic help_topic_id) override { |
178 NOTIMPLEMENTED(); | 179 // TODO(xiaoyinh): Complete the implementation here. |
| 180 LockScreenClient::Get()->ShowErrorMessage(0 /* login_attempts */, |
| 181 std::string(), std::string(), |
| 182 static_cast<int>(help_topic_id)); |
179 } | 183 } |
180 void ClearErrors() override { NOTIMPLEMENTED(); } | 184 void ClearErrors() override { LockScreenClient::Get()->ClearErrors(); } |
181 void AnimateAuthenticationSuccess() override { NOTIMPLEMENTED(); } | 185 void AnimateAuthenticationSuccess() override { NOTIMPLEMENTED(); } |
182 void OnLockWebUIReady() override { NOTIMPLEMENTED(); } | 186 void OnLockWebUIReady() override { NOTIMPLEMENTED(); } |
183 void OnLockBackgroundDisplayed() override { NOTIMPLEMENTED(); } | 187 void OnLockBackgroundDisplayed() override { NOTIMPLEMENTED(); } |
184 void OnHeaderBarVisible() override { NOTIMPLEMENTED(); } | 188 void OnHeaderBarVisible() override { NOTIMPLEMENTED(); } |
185 void OnAshLockAnimationFinished() override { NOTIMPLEMENTED(); } | 189 void OnAshLockAnimationFinished() override { NOTIMPLEMENTED(); } |
186 void SetFingerprintState(const AccountId& account_id, | 190 void SetFingerprintState(const AccountId& account_id, |
187 ScreenLocker::FingerprintState state) override { | 191 ScreenLocker::FingerprintState state) override { |
188 NOTIMPLEMENTED(); | 192 NOTIMPLEMENTED(); |
189 } | 193 } |
190 content::WebContents* GetWebContents() override { return nullptr; } | 194 content::WebContents* GetWebContents() override { return nullptr; } |
191 | 195 |
192 private: | 196 private: |
193 DISALLOW_COPY_AND_ASSIGN(StubDelegate); | 197 DISALLOW_COPY_AND_ASSIGN(MojoDelegate); |
194 }; | 198 }; |
195 | 199 |
196 ScreenLockObserver* g_screen_lock_observer = nullptr; | 200 ScreenLockObserver* g_screen_lock_observer = nullptr; |
197 | 201 |
198 } // namespace | 202 } // namespace |
199 | 203 |
200 // static | 204 // static |
201 ScreenLocker* ScreenLocker::screen_locker_ = nullptr; | 205 ScreenLocker* ScreenLocker::screen_locker_ = nullptr; |
202 | 206 |
203 ////////////////////////////////////////////////////////////////////////////// | 207 ////////////////////////////////////////////////////////////////////////////// |
(...skipping 25 matching lines...) Expand all Loading... |
229 | 233 |
230 void ScreenLocker::Init() { | 234 void ScreenLocker::Init() { |
231 input_method::InputMethodManager* imm = | 235 input_method::InputMethodManager* imm = |
232 input_method::InputMethodManager::Get(); | 236 input_method::InputMethodManager::Get(); |
233 saved_ime_state_ = imm->GetActiveIMEState(); | 237 saved_ime_state_ = imm->GetActiveIMEState(); |
234 imm->SetState(saved_ime_state_->Clone()); | 238 imm->SetState(saved_ime_state_->Clone()); |
235 | 239 |
236 authenticator_ = UserSessionManager::GetInstance()->CreateAuthenticator(this); | 240 authenticator_ = UserSessionManager::GetInstance()->CreateAuthenticator(this); |
237 extended_authenticator_ = ExtendedAuthenticator::Create(this); | 241 extended_authenticator_ = ExtendedAuthenticator::Create(this); |
238 if (IsUsingMdLogin()) { | 242 if (IsUsingMdLogin()) { |
239 // Create delegate that will eventually call into the views-based lock | 243 // Create delegate that calls into the views-based lock screen via mojo. |
240 // screen via mojo. | 244 delegate_ = new MojoDelegate(); |
241 delegate_ = new StubDelegate(); | |
242 owns_delegate_ = true; | 245 owns_delegate_ = true; |
243 | 246 |
244 // Create and display lock screen. | 247 // Create and display lock screen. |
245 // TODO(jdufault): Calling ash::ShowLockScreenInWidget should be a mojo | 248 // TODO(jdufault): Calling ash::ShowLockScreenInWidget should be a mojo |
246 // call. We should only set the session state to locked after the mojo call | 249 // call. We should only set the session state to locked after the mojo call |
247 // has completed. | 250 // has completed. |
248 if (ash::ShowLockScreen()) { | 251 if (ash::ShowLockScreen()) { |
249 session_manager::SessionManager::Get()->SetSessionState( | 252 session_manager::SessionManager::Get()->SetSessionState( |
250 session_manager::SessionState::LOCKED); | 253 session_manager::SessionState::LOCKED); |
251 } | 254 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 719 } |
717 } | 720 } |
718 | 721 |
719 if (auth_status_consumer_) { | 722 if (auth_status_consumer_) { |
720 AuthFailure failure(AuthFailure::UNLOCK_FAILED); | 723 AuthFailure failure(AuthFailure::UNLOCK_FAILED); |
721 auth_status_consumer_->OnAuthFailure(failure); | 724 auth_status_consumer_->OnAuthFailure(failure); |
722 } | 725 } |
723 } | 726 } |
724 | 727 |
725 } // namespace chromeos | 728 } // namespace chromeos |
OLD | NEW |