| 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 "remoting/host/verify_config_window_win.h" | 5 #include "remoting/host/verify_config_window_win.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlwin.h> | 8 #include <atlwin.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 LRESULT VerifyConfigWindowWin::OnInitDialog(HWND wparam, LPARAM lparam) { | 36 LRESULT VerifyConfigWindowWin::OnInitDialog(HWND wparam, LPARAM lparam) { |
| 37 // Set the small window icon. | 37 // Set the small window icon. |
| 38 if (icon_.LoadIcon(IDD, ::GetSystemMetrics(SM_CXSMICON), | 38 if (icon_.LoadIcon(IDD, ::GetSystemMetrics(SM_CXSMICON), |
| 39 ::GetSystemMetrics(SM_CYSMICON)) != NULL) { | 39 ::GetSystemMetrics(SM_CYSMICON)) != NULL) { |
| 40 SetIcon(icon_, FALSE); | 40 SetIcon(icon_, FALSE); |
| 41 } | 41 } |
| 42 | 42 |
| 43 CenterWindow(); | 43 CenterWindow(); |
| 44 | 44 |
| 45 CWindow email_text(GetDlgItem(IDC_EMAIL)); | 45 CWindow email_text(GetDlgItem(IDC_EMAIL)); |
| 46 email_text.SetWindowText(UTF8ToUTF16(email_).c_str()); | 46 email_text.SetWindowText(base::UTF8ToUTF16(email_).c_str()); |
| 47 return TRUE; | 47 return TRUE; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void VerifyConfigWindowWin::OnOk(UINT code, int id, HWND control) { | 50 void VerifyConfigWindowWin::OnOk(UINT code, int id, HWND control) { |
| 51 if (VerifyHostSecretHash()) { | 51 if (VerifyHostSecretHash()) { |
| 52 EndDialog(ERROR_SUCCESS); | 52 EndDialog(ERROR_SUCCESS); |
| 53 } else { | 53 } else { |
| 54 EndDialog(ERROR_LOGON_FAILURE); | 54 EndDialog(ERROR_LOGON_FAILURE); |
| 55 } | 55 } |
| 56 } | 56 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 CWindow pin_edit(GetDlgItem(IDC_PIN)); | 107 CWindow pin_edit(GetDlgItem(IDC_PIN)); |
| 108 | 108 |
| 109 // Get the PIN length. | 109 // Get the PIN length. |
| 110 int pin_length = pin_edit.GetWindowTextLength(); | 110 int pin_length = pin_edit.GetWindowTextLength(); |
| 111 scoped_ptr<char16[]> pin(new char16[pin_length + 1]); | 111 scoped_ptr<char16[]> pin(new char16[pin_length + 1]); |
| 112 | 112 |
| 113 // Get the PIN making sure it is NULL terminated even if an error occurs. | 113 // Get the PIN making sure it is NULL terminated even if an error occurs. |
| 114 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); | 114 int result = pin_edit.GetWindowText(pin.get(), pin_length + 1); |
| 115 pin[std::min(result, pin_length)] = 0; | 115 pin[std::min(result, pin_length)] = 0; |
| 116 | 116 |
| 117 return VerifyHostPinHash(host_secret_hash_, host_id_, UTF16ToUTF8(pin.get())); | 117 return VerifyHostPinHash(host_secret_hash_, |
| 118 host_id_, base::UTF16ToUTF8(pin.get())); |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace remoting | 121 } // namespace remoting |
| OLD | NEW |