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