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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_SETUP_WIN_START_HOST_WINDOW_H_
6 #define REMOTING_HOST_SETUP_WIN_START_HOST_WINDOW_H_
8 // altbase.h must be included before atlapp.h
17 #include "base/basictypes.h"
18 #include "net/url_request/url_request_context_getter.h"
19 #include "remoting/host/setup/win/auth_code_getter.h"
20 #include "remoting/host/setup/host_starter.h"
21 #include "remoting/host/setup/win/host_configurer_resource.h"
25 // A dialog box that lets the user register and start a host.
26 class StartHostWindow : public ATL::CDialogImpl<StartHostWindow> {
28 enum { IDD = IDD_START_HOST };
30 BEGIN_MSG_MAP_EX(StartHostWindowWin)
31 MSG_WM_INITDIALOG(OnInitDialog)
33 COMMAND_ID_HANDLER_EX(IDC_CONSENT, OnConsent)
34 COMMAND_ID_HANDLER_EX(IDOK, OnOk)
35 COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
39 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
42 void OnCancel(UINT code, int id, HWND control);
44 LRESULT OnInitDialog(HWND wparam, LPARAM lparam);
45 void OnConsent(UINT code, int id, HWND control);
46 void OnOk(UINT code, int id, HWND control);
47 void OnAuthCode(const std::string& auth_code);
48 void OnHostStarted(remoting::HostStarter::Result result);
50 // Gets the text associated with an item in this dialog box.
51 std::string GetDlgItemString(int id);
53 remoting::AuthCodeGetter auth_code_getter_;
54 scoped_ptr<remoting::HostStarter> host_starter_;
56 // Data read from widgets in the dialog box.
57 std::string host_name_;
59 bool consent_to_collect_data_;
61 // A string manager that lets us use CSimpleString.
63 CAtlStringMgr string_mgr_;
65 // WeakPtr used to avoid AuthCodeGetter or HostStarter callbacks accessing
66 // this dialog box after it's closed.
67 base::WeakPtrFactory<StartHostWindow> weak_ptr_factory_;
68 base::WeakPtr<StartHostWindow> weak_ptr_;
70 DISALLOW_COPY_AND_ASSIGN(StartHostWindow);
73 } // namespace remoting
75 #endif // REMOTING_HOST_SETUP_WIN_START_HOST_WINDOW_H_