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/continue_window.h" | 5 #include "remoting/host/continue_window.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/process_util.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "remoting/host/host_ui_resource.h" | |
13 #include "remoting/host/ui_strings.h" | 13 #include "remoting/host/ui_strings.h" |
| 14 #include "remoting/host/win/core_resource.h" |
14 | 15 |
15 // TODO(garykac): Lots of duplicated code in this file and | 16 // TODO(garykac): Lots of duplicated code in this file and |
16 // disconnect_window_win.cc. These global floating windows are temporary so | 17 // disconnect_window_win.cc. These global floating windows are temporary so |
17 // they should be deleted soon. If we need to expand this then we should | 18 // they should be deleted soon. If we need to expand this then we should |
18 // create a class with the shared code. | 19 // create a class with the shared code. |
19 | 20 |
20 // HMODULE from DllMain/WinMain. This is needed to find our dialog resource. | |
21 // This is defined in: | |
22 // Plugin: host_plugin.cc | |
23 // SimpleHost: simple_host_process.cc | |
24 extern HMODULE g_hModule; | |
25 | |
26 namespace remoting { | 21 namespace remoting { |
27 | 22 |
28 class ContinueWindowWin : public ContinueWindow { | 23 class ContinueWindowWin : public ContinueWindow { |
29 public: | 24 public: |
30 explicit ContinueWindowWin(const UiStrings* ui_strings); | 25 explicit ContinueWindowWin(const UiStrings* ui_strings); |
31 virtual ~ContinueWindowWin(); | 26 virtual ~ContinueWindowWin(); |
32 | 27 |
33 virtual void Show(const ContinueSessionCallback& callback) OVERRIDE; | 28 virtual void Show(const ContinueSessionCallback& callback) OVERRIDE; |
34 virtual void Hide() OVERRIDE; | 29 virtual void Hide() OVERRIDE; |
35 | 30 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 hwnd_ = NULL; | 94 hwnd_ = NULL; |
100 return TRUE; | 95 return TRUE; |
101 } | 96 } |
102 } | 97 } |
103 return FALSE; | 98 return FALSE; |
104 } | 99 } |
105 | 100 |
106 void ContinueWindowWin::Show(const ContinueSessionCallback& callback) { | 101 void ContinueWindowWin::Show(const ContinueSessionCallback& callback) { |
107 callback_ = callback; | 102 callback_ = callback; |
108 | 103 |
| 104 HMODULE instance = base::GetModuleFromAddress(&DialogProc); |
| 105 |
109 CHECK(!hwnd_); | 106 CHECK(!hwnd_); |
110 hwnd_ = CreateDialogParam(g_hModule, MAKEINTRESOURCE(IDD_CONTINUE), NULL, | 107 hwnd_ = CreateDialogParam(instance, MAKEINTRESOURCE(IDD_CONTINUE), NULL, |
111 (DLGPROC)DialogProc, (LPARAM)this); | 108 (DLGPROC)DialogProc, (LPARAM)this); |
112 if (!hwnd_) { | 109 if (!hwnd_) { |
113 LOG(ERROR) << "Unable to create Disconnect dialog for remoting."; | 110 LOG(ERROR) << "Unable to create Disconnect dialog for remoting."; |
114 return; | 111 return; |
115 } | 112 } |
116 | 113 |
117 SetStrings(); | 114 SetStrings(); |
118 ShowWindow(hwnd_, SW_SHOW); | 115 ShowWindow(hwnd_, SW_SHOW); |
119 } | 116 } |
120 | 117 |
(...skipping 22 matching lines...) Expand all Loading... |
143 HWND hwndCancel = GetDlgItem(hwnd_, IDC_CONTINUE_CANCEL); | 140 HWND hwndCancel = GetDlgItem(hwnd_, IDC_CONTINUE_CANCEL); |
144 CHECK(hwndCancel); | 141 CHECK(hwndCancel); |
145 SetWindowText(hwndCancel, ui_strings_->stop_sharing_button_text.c_str()); | 142 SetWindowText(hwndCancel, ui_strings_->stop_sharing_button_text.c_str()); |
146 } | 143 } |
147 | 144 |
148 scoped_ptr<ContinueWindow> ContinueWindow::Create(const UiStrings* ui_strings) { | 145 scoped_ptr<ContinueWindow> ContinueWindow::Create(const UiStrings* ui_strings) { |
149 return scoped_ptr<ContinueWindow>(new ContinueWindowWin(ui_strings)); | 146 return scoped_ptr<ContinueWindow>(new ContinueWindowWin(ui_strings)); |
150 } | 147 } |
151 | 148 |
152 } // namespace remoting | 149 } // namespace remoting |
OLD | NEW |