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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "remoting/host/chromoting_host.h" | 12 #include "remoting/host/chromoting_host.h" |
13 // TODO(wez): The DisconnectWindow isn't plugin-specific, so shouldn't have | 13 #include "remoting/host/host_ui_resource.h" |
14 // a dependency on the plugin's resource header. | |
15 #include "remoting/host/plugin/host_plugin_resource.h" | |
16 | 14 |
17 // TODO(garykac): Lots of duplicated code in this file and | 15 // TODO(garykac): Lots of duplicated code in this file and |
18 // disconnect_window_win.cc. These global floating windows are temporary so | 16 // disconnect_window_win.cc. These global floating windows are temporary so |
19 // 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 |
20 // create a class with the shared code. | 18 // create a class with the shared code. |
21 | 19 |
22 // HMODULE from DllMain/WinMain. This is needed to find our dialog resource. | 20 // HMODULE from DllMain/WinMain. This is needed to find our dialog resource. |
23 // This is defined in: | 21 // This is defined in: |
24 // Plugin: host_plugin.cc | 22 // Plugin: host_plugin.cc |
25 // SimpleHost: simple_host_process.cc | 23 // SimpleHost: simple_host_process.cc |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 SetStrings(host->ui_strings()); | 118 SetStrings(host->ui_strings()); |
121 ShowWindow(hwnd_, SW_SHOW); | 119 ShowWindow(hwnd_, SW_SHOW); |
122 } | 120 } |
123 | 121 |
124 void ContinueWindowWin::Hide() { | 122 void ContinueWindowWin::Hide() { |
125 EndDialog(); | 123 EndDialog(); |
126 } | 124 } |
127 | 125 |
128 void ContinueWindowWin::EndDialog() { | 126 void ContinueWindowWin::EndDialog() { |
129 if (hwnd_) { | 127 if (hwnd_) { |
130 ::EndDialog(hwnd_, 0); | 128 ::DestroyWindow(hwnd_); |
Jamie
2012/05/11 19:51:39
What's the effect of this change?
alexeypa (please no reviews)
2012/05/11 20:01:21
EndDialog() does not have effect on non-modal dial
| |
131 hwnd_ = NULL; | 129 hwnd_ = NULL; |
132 } | 130 } |
133 } | 131 } |
134 | 132 |
135 void ContinueWindowWin::SetStrings(const UiStrings& strings) { | 133 void ContinueWindowWin::SetStrings(const UiStrings& strings) { |
136 SetWindowText(hwnd_, strings.product_name.c_str()); | 134 SetWindowText(hwnd_, strings.product_name.c_str()); |
137 | 135 |
138 HWND hwndMessage = GetDlgItem(hwnd_, IDC_CONTINUE_MESSAGE); | 136 HWND hwndMessage = GetDlgItem(hwnd_, IDC_CONTINUE_MESSAGE); |
139 CHECK(hwndMessage); | 137 CHECK(hwndMessage); |
140 SetWindowText(hwndMessage, strings.continue_prompt.c_str()); | 138 SetWindowText(hwndMessage, strings.continue_prompt.c_str()); |
141 | 139 |
142 HWND hwndDefault = GetDlgItem(hwnd_, IDC_CONTINUE_DEFAULT); | 140 HWND hwndDefault = GetDlgItem(hwnd_, IDC_CONTINUE_DEFAULT); |
143 CHECK(hwndDefault); | 141 CHECK(hwndDefault); |
144 SetWindowText(hwndDefault, strings.continue_button_text.c_str()); | 142 SetWindowText(hwndDefault, strings.continue_button_text.c_str()); |
145 | 143 |
146 HWND hwndCancel = GetDlgItem(hwnd_, IDC_CONTINUE_CANCEL); | 144 HWND hwndCancel = GetDlgItem(hwnd_, IDC_CONTINUE_CANCEL); |
147 CHECK(hwndCancel); | 145 CHECK(hwndCancel); |
148 SetWindowText(hwndCancel, strings.stop_sharing_button_text.c_str()); | 146 SetWindowText(hwndCancel, strings.stop_sharing_button_text.c_str()); |
149 } | 147 } |
150 | 148 |
151 scoped_ptr<ContinueWindow> ContinueWindow::Create() { | 149 scoped_ptr<ContinueWindow> ContinueWindow::Create() { |
152 return scoped_ptr<ContinueWindow>(new ContinueWindowWin()); | 150 return scoped_ptr<ContinueWindow>(new ContinueWindowWin()); |
153 } | 151 } |
154 | 152 |
155 } // namespace remoting | 153 } // namespace remoting |
OLD | NEW |