| 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 #ifndef REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H | 5 #ifndef REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H |
| 6 #define REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H | 6 #define REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H |
| 7 | 7 |
| 8 #include <atlbase.h> |
| 9 #include <atlcrack.h> |
| 10 #include <atlwin.h> |
| 8 #include <string> | 11 #include <string> |
| 9 | 12 |
| 10 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "remoting/host/elevated_controller_resource.h" |
| 11 | 15 |
| 12 namespace remoting { | 16 namespace remoting { |
| 13 | 17 |
| 14 // TODO(simonmorris): Derive this class from ATL's CDialog. | 18 class VerifyConfigWindowWin : public ATL::CDialogImpl<VerifyConfigWindowWin> { |
| 15 class VerifyConfigWindowWin { | |
| 16 public: | 19 public: |
| 17 VerifyConfigWindowWin(const std::string& email, | 20 enum { IDD = IDD_VERIFY_CONFIG_DIALOG }; |
| 18 const std::string& host_id, | |
| 19 const std::string& host_secret_hash); | |
| 20 ~VerifyConfigWindowWin(); | |
| 21 | 21 |
| 22 // Run the dialog modally. Returns true on successful verification. | 22 BEGIN_MSG_MAP_EX(VerifyConfigWindowWin) |
| 23 bool Run(); | 23 MSG_WM_INITDIALOG(OnInitDialog) |
| 24 MSG_WM_CLOSE(OnClose) |
| 25 COMMAND_ID_HANDLER_EX(IDOK, OnOk) |
| 26 COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) |
| 27 END_MSG_MAP() |
| 28 |
| 29 VerifyConfigWindowWin(const std::string& email, |
| 30 const std::string& host_id, |
| 31 const std::string& host_secret_hash); |
| 32 |
| 33 void OnCancel(UINT code, int id, HWND control); |
| 34 void OnClose(); |
| 35 LRESULT OnInitDialog(HWND wparam, LPARAM lparam); |
| 36 void OnOk(UINT code, int id, HWND control); |
| 24 | 37 |
| 25 private: | 38 private: |
| 26 static BOOL CALLBACK DialogProc(HWND hwmd, UINT msg, WPARAM wParam, | 39 // Centers the dialog window against the owner window. |
| 27 LPARAM lParam); | 40 void CenterWindow(); |
| 28 | |
| 29 BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); | |
| 30 | |
| 31 void InitDialog(); | |
| 32 void EndDialog(); | |
| 33 bool VerifyHostSecretHash(); | 41 bool VerifyHostSecretHash(); |
| 34 | 42 |
| 35 HWND hwnd_; | |
| 36 const std::string email_; | 43 const std::string email_; |
| 37 const std::string host_id_; | 44 const std::string host_id_; |
| 38 const std::string host_secret_hash_; | 45 const std::string host_secret_hash_; |
| 39 | 46 |
| 40 DISALLOW_COPY_AND_ASSIGN(VerifyConfigWindowWin); | 47 DISALLOW_COPY_AND_ASSIGN(VerifyConfigWindowWin); |
| 41 }; | 48 }; |
| 42 | 49 |
| 43 } | 50 } |
| 44 | 51 |
| 45 #endif // REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H | 52 #endif // REMOTING_HOST_VERIFY_CONFIG_WINDOW_WIN_H |
| OLD | NEW |