| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/login/ui/login_auth_user_view.h" | 5 #include "ash/login/ui/login_auth_user_view.h" |
| 6 | 6 |
| 7 #include "ash/login/lock_screen_controller.h" | 7 #include "ash/login/lock_screen_controller.h" |
| 8 #include "ash/login/ui/lock_screen.h" | 8 #include "ash/login/ui/lock_screen.h" |
| 9 #include "ash/login/ui/login_display_style.h" | 9 #include "ash/login/ui/login_display_style.h" |
| 10 #include "ash/login/ui/login_password_view.h" | 10 #include "ash/login/ui/login_password_view.h" |
| 11 #include "ash/login/ui/login_pin_view.h" | 11 #include "ash/login/ui/login_pin_view.h" |
| 12 #include "ash/login/ui/login_user_view.h" | 12 #include "ash/login/ui/login_user_view.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "components/user_manager/user.h" | 15 #include "components/user_manager/user.h" |
| 15 #include "ui/views/layout/box_layout.h" | 16 #include "ui/views/layout/box_layout.h" |
| 16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const char* kLoginAuthUserViewClassName = "LoginAuthUserView"; | 22 const char* kLoginAuthUserViewClassName = "LoginAuthUserView"; |
| 22 | 23 |
| 23 // Distance between the username label and the password textfield. | 24 // Distance between the username label and the password textfield. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 gfx::Size size = views::View::CalculatePreferredSize(); | 114 gfx::Size size = views::View::CalculatePreferredSize(); |
| 114 // Make sure we are at least as big as the user view. If we do not do this the | 115 // Make sure we are at least as big as the user view. If we do not do this the |
| 115 // view will be below minimum size when no auth methods are displayed. | 116 // view will be below minimum size when no auth methods are displayed. |
| 116 size.SetToMax(user_view_->GetPreferredSize()); | 117 size.SetToMax(user_view_->GetPreferredSize()); |
| 117 return size; | 118 return size; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void LoginAuthUserView::OnAuthSubmit(bool is_pin, | 121 void LoginAuthUserView::OnAuthSubmit(bool is_pin, |
| 121 const base::string16& password) { | 122 const base::string16& password) { |
| 122 Shell::Get()->lock_screen_controller()->AuthenticateUser( | 123 Shell::Get()->lock_screen_controller()->AuthenticateUser( |
| 123 current_user_, std::string(), is_pin, | 124 current_user_, UTF16ToUTF8(password), is_pin, |
| 124 base::BindOnce([](OnAuthCallback on_auth, | 125 base::BindOnce([](OnAuthCallback on_auth, |
| 125 bool auth_success) { on_auth.Run(auth_success); }, | 126 bool auth_success) { on_auth.Run(auth_success); }, |
| 126 on_auth_)); | 127 on_auth_)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace ash | 130 } // namespace ash |
| OLD | NEW |