Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: remoting/host/disconnect_window_win.cc

Issue 13212009: Made DesktopEnvironment responsible for creation of the disconnect window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Linux & Mac. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/disconnect_window.h"
6
7 #include <windows.h> 5 #include <windows.h>
8 6
7 #include "base/bind.h"
9 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/win/scoped_gdi_object.h" 14 #include "base/win/scoped_gdi_object.h"
15 #include "base/win/scoped_hdc.h" 15 #include "base/win/scoped_hdc.h"
16 #include "base/win/scoped_select_object.h" 16 #include "base/win/scoped_select_object.h"
17 #include "remoting/host/host_window.h"
17 #include "remoting/host/ui_strings.h" 18 #include "remoting/host/ui_strings.h"
18 #include "remoting/host/win/core_resource.h" 19 #include "remoting/host/win/core_resource.h"
19 20
20 // TODO(garykac): Lots of duplicated code in this file and 21 namespace remoting {
21 // continue_window_win.cc. If we need to expand this then we should
22 // create a class with the shared code.
23 22
24 namespace { 23 namespace {
25 24
26 const int DISCONNECT_HOTKEY_ID = 1000; 25 const int DISCONNECT_HOTKEY_ID = 1000;
27 26
28 // Maximum length of "Your desktop is shared with ..." message in UTF-16 27 // Maximum length of "Your desktop is shared with ..." message in UTF-16
29 // characters. 28 // characters.
30 const size_t kMaxSharingWithTextLength = 100; 29 const size_t kMaxSharingWithTextLength = 100;
31 30
32 const wchar_t kShellTrayWindowName[] = L"Shell_TrayWnd"; 31 const wchar_t kShellTrayWindowName[] = L"Shell_TrayWnd";
33 const int kWindowBorderRadius = 14; 32 const int kWindowBorderRadius = 14;
34 33
35 } // namespace anonymous 34 class DisconnectWindowWin : public HostWindow::Core {
35 public:
36 DisconnectWindowWin(
37 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
38 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
39 const base::Closure& disconnect_callback,
40 const std::string& username,
41 const UiStrings& ui_strings);
36 42
37 namespace remoting { 43 protected:
38 44 friend class base::RefCountedThreadSafe<Core>;
39 class DisconnectWindowWin : public DisconnectWindow {
40 public:
41 explicit DisconnectWindowWin(const UiStrings* ui_strings);
42 virtual ~DisconnectWindowWin(); 45 virtual ~DisconnectWindowWin();
43 46
44 // DisconnectWindow interface. 47 // HostWindow::Core overrides.
45 virtual bool Show(const base::Closure& disconnect_callback, 48 virtual void StartOnUiThread() OVERRIDE;
46 const std::string& username) OVERRIDE; 49 virtual void StopOnUiThread() OVERRIDE;
47 virtual void Hide() OVERRIDE;
48 50
49 private:
50 static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam, 51 static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam,
51 LPARAM lparam); 52 LPARAM lparam);
52 53
53 BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 54 BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
54 55
55 // Creates the dialog window and registers the disconnect hot key. 56 // Creates the dialog window and registers the disconnect hot key.
56 bool BeginDialog(const std::string& username); 57 bool BeginDialog();
57 58
58 // Closes the dialog, unregisters the hot key and invokes the disconnect 59 // Closes the dialog, unregisters the hot key and invokes the disconnect
59 // callback, if set. 60 // callback, if set.
60 void EndDialog(); 61 void EndDialog();
61 62
62 // Trys to position the dialog window above the taskbar. 63 // Trys to position the dialog window above the taskbar.
63 void SetDialogPosition(); 64 void SetDialogPosition();
64 65
65 // Applies localization string and resizes the dialog. 66 // Applies localization string and resizes the dialog.
66 bool SetStrings(const string16& username); 67 bool SetStrings();
67 68
69 // Invoked in the |caller_task_runner_| thread to disconnect the client
70 // session.
68 base::Closure disconnect_callback_; 71 base::Closure disconnect_callback_;
72
73 // Specifies the remote user name.
74 std::string username_;
75
69 HWND hwnd_; 76 HWND hwnd_;
70 bool has_hotkey_; 77 bool has_hotkey_;
71 base::win::ScopedGDIObject<HPEN> border_pen_; 78 base::win::ScopedGDIObject<HPEN> border_pen_;
72 79
73 // Points to the localized strings.
74 const UiStrings* ui_strings_;
75
76 DISALLOW_COPY_AND_ASSIGN(DisconnectWindowWin); 80 DISALLOW_COPY_AND_ASSIGN(DisconnectWindowWin);
77 }; 81 };
78 82
79 static int GetControlTextWidth(HWND control) { 83 int GetControlTextWidth(HWND control) {
80 RECT rect = {0, 0, 0, 0}; 84 RECT rect = {0, 0, 0, 0};
81 WCHAR text[256]; 85 WCHAR text[256];
82 int result = GetWindowText(control, text, arraysize(text)); 86 int result = GetWindowText(control, text, arraysize(text));
83 if (result) { 87 if (result) {
84 base::win::ScopedGetDC dc(control); 88 base::win::ScopedGetDC dc(control);
85 base::win::ScopedSelectObject font( 89 base::win::ScopedSelectObject font(
86 dc, (HFONT)SendMessage(control, WM_GETFONT, 0, 0)); 90 dc, (HFONT)SendMessage(control, WM_GETFONT, 0, 0));
87 DrawText(dc, text, -1, &rect, DT_CALCRECT | DT_SINGLELINE); 91 DrawText(dc, text, -1, &rect, DT_CALCRECT | DT_SINGLELINE);
88 } 92 }
89 return rect.right; 93 return rect.right;
90 } 94 }
91 95
92 DisconnectWindowWin::DisconnectWindowWin(const UiStrings* ui_strings) 96 DisconnectWindowWin::DisconnectWindowWin(
93 : hwnd_(NULL), 97 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
98 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
99 const base::Closure& disconnect_callback,
100 const std::string& username,
101 const UiStrings& ui_strings)
102 : HostWindow::Core(caller_task_runner,
103 ui_task_runner,
104 ui_strings),
105 disconnect_callback_(disconnect_callback),
106 username_(username),
107 hwnd_(NULL),
94 has_hotkey_(false), 108 has_hotkey_(false),
95 border_pen_(CreatePen(PS_SOLID, 5, 109 border_pen_(CreatePen(PS_SOLID, 5,
96 RGB(0.13 * 255, 0.69 * 255, 0.11 * 255))), 110 RGB(0.13 * 255, 0.69 * 255, 0.11 * 255))) {
97 ui_strings_(ui_strings) {
98 } 111 }
99 112
100 DisconnectWindowWin::~DisconnectWindowWin() { 113 DisconnectWindowWin::~DisconnectWindowWin() {
101 Hide();
102 } 114 }
103 115
104 bool DisconnectWindowWin::Show(const base::Closure& disconnect_callback, 116 void DisconnectWindowWin::StartOnUiThread() {
105 const std::string& username) { 117 DCHECK(ui_task_runner()->BelongsToCurrentThread());
106 DCHECK(disconnect_callback_.is_null());
107 DCHECK(!disconnect_callback.is_null());
108 118
109 disconnect_callback_ = disconnect_callback; 119 if (!BeginDialog()) {
110 120 StopOnUiThread();
111 if (BeginDialog(username)) { 121 caller_task_runner()->PostTask(FROM_HERE, disconnect_callback_);
112 return true;
113 } else {
114 Hide();
115 return false;
116 } 122 }
117 } 123 }
118 124
119 void DisconnectWindowWin::Hide() { 125 void DisconnectWindowWin::StopOnUiThread() {
120 // Clear the |disconnect_callback_| so it won't be invoked by EndDialog(). 126 DCHECK(ui_task_runner()->BelongsToCurrentThread());
121 disconnect_callback_.Reset(); 127
122 EndDialog(); 128 EndDialog();
123 } 129 }
124 130
125 INT_PTR CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd, UINT message, 131 INT_PTR CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd,
126 WPARAM wparam, LPARAM lparam) { 132 UINT message,
133 WPARAM wparam,
134 LPARAM lparam) {
127 LONG_PTR self = NULL; 135 LONG_PTR self = NULL;
128 if (message == WM_INITDIALOG) { 136 if (message == WM_INITDIALOG) {
129 self = lparam; 137 self = lparam;
130 138
131 // Store |this| to the window's user data. 139 // Store |this| to the window's user data.
132 SetLastError(ERROR_SUCCESS); 140 SetLastError(ERROR_SUCCESS);
133 LONG_PTR result = SetWindowLongPtr(hwnd, DWLP_USER, self); 141 LONG_PTR result = SetWindowLongPtr(hwnd, DWLP_USER, self);
134 if (result == 0 && GetLastError() != ERROR_SUCCESS) 142 if (result == 0 && GetLastError() != ERROR_SUCCESS)
135 reinterpret_cast<DisconnectWindowWin*>(self)->EndDialog(); 143 reinterpret_cast<DisconnectWindowWin*>(self)->EndDialog();
136 } else { 144 } else {
137 self = GetWindowLongPtr(hwnd, DWLP_USER); 145 self = GetWindowLongPtr(hwnd, DWLP_USER);
138 } 146 }
139 147
140 if (self) { 148 if (self) {
141 return reinterpret_cast<DisconnectWindowWin*>(self)->OnDialogMessage( 149 return reinterpret_cast<DisconnectWindowWin*>(self)->OnDialogMessage(
142 hwnd, message, wparam, lparam); 150 hwnd, message, wparam, lparam);
143 } 151 }
144 return FALSE; 152 return FALSE;
145 } 153 }
146 154
147 BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT message, 155 BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd,
148 WPARAM wparam, LPARAM lparam) { 156 UINT message,
157 WPARAM wparam,
158 LPARAM lparam) {
159 DCHECK(ui_task_runner()->BelongsToCurrentThread());
160
149 switch (message) { 161 switch (message) {
150 // Ignore close messages. 162 // Ignore close messages.
151 case WM_CLOSE: 163 case WM_CLOSE:
152 return TRUE; 164 return TRUE;
153 165
154 // Handle the Disconnect button. 166 // Handle the Disconnect button.
155 case WM_COMMAND: 167 case WM_COMMAND:
156 switch (LOWORD(wparam)) { 168 switch (LOWORD(wparam)) {
157 case IDC_DISCONNECT: 169 case IDC_DISCONNECT:
158 EndDialog(); 170 EndDialog();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 RoundRect(hdc, rect.left, rect.top, rect.right - 1, rect.bottom - 1, 215 RoundRect(hdc, rect.left, rect.top, rect.right - 1, rect.bottom - 1,
204 kWindowBorderRadius, kWindowBorderRadius); 216 kWindowBorderRadius, kWindowBorderRadius);
205 } 217 }
206 EndPaint(hwnd_, &ps); 218 EndPaint(hwnd_, &ps);
207 return TRUE; 219 return TRUE;
208 } 220 }
209 } 221 }
210 return FALSE; 222 return FALSE;
211 } 223 }
212 224
213 bool DisconnectWindowWin::BeginDialog(const std::string& username) { 225 bool DisconnectWindowWin::BeginDialog() {
226 DCHECK(ui_task_runner()->BelongsToCurrentThread());
214 DCHECK(!hwnd_); 227 DCHECK(!hwnd_);
215 228
216 // Load the dialog resource so that we can modify the RTL flags if necessary. 229 // Load the dialog resource so that we can modify the RTL flags if necessary.
217 HMODULE module = base::GetModuleFromAddress(&DialogProc); 230 HMODULE module = base::GetModuleFromAddress(&DialogProc);
218 HRSRC dialog_resource = 231 HRSRC dialog_resource =
219 FindResource(module, MAKEINTRESOURCE(IDD_DISCONNECT), RT_DIALOG); 232 FindResource(module, MAKEINTRESOURCE(IDD_DISCONNECT), RT_DIALOG);
220 if (!dialog_resource) 233 if (!dialog_resource)
221 return false; 234 return false;
222 235
223 HGLOBAL dialog_template = LoadResource(module, dialog_resource); 236 HGLOBAL dialog_template = LoadResource(module, dialog_resource);
224 if (!dialog_template) 237 if (!dialog_template)
225 return false; 238 return false;
226 239
227 DLGTEMPLATE* dialog_pointer = 240 DLGTEMPLATE* dialog_pointer =
228 reinterpret_cast<DLGTEMPLATE*>(LockResource(dialog_template)); 241 reinterpret_cast<DLGTEMPLATE*>(LockResource(dialog_template));
229 if (!dialog_pointer) 242 if (!dialog_pointer)
230 return false; 243 return false;
231 244
232 // The actual resource type is DLGTEMPLATEEX, but this is not defined in any 245 // The actual resource type is DLGTEMPLATEEX, but this is not defined in any
233 // standard headers, so we treat it as a generic pointer and manipulate the 246 // standard headers, so we treat it as a generic pointer and manipulate the
234 // correct offsets explicitly. 247 // correct offsets explicitly.
235 scoped_array<unsigned char> rtl_dialog_template; 248 scoped_array<unsigned char> rtl_dialog_template;
236 if (ui_strings_->direction == UiStrings::RTL) { 249 if (ui_strings().direction == UiStrings::RTL) {
237 unsigned long dialog_template_size = 250 unsigned long dialog_template_size =
238 SizeofResource(module, dialog_resource); 251 SizeofResource(module, dialog_resource);
239 rtl_dialog_template.reset(new unsigned char[dialog_template_size]); 252 rtl_dialog_template.reset(new unsigned char[dialog_template_size]);
240 memcpy(rtl_dialog_template.get(), dialog_pointer, dialog_template_size); 253 memcpy(rtl_dialog_template.get(), dialog_pointer, dialog_template_size);
241 DWORD* rtl_dwords = reinterpret_cast<DWORD*>(rtl_dialog_template.get()); 254 DWORD* rtl_dwords = reinterpret_cast<DWORD*>(rtl_dialog_template.get());
242 rtl_dwords[2] |= (WS_EX_LAYOUTRTL | WS_EX_RTLREADING); 255 rtl_dwords[2] |= (WS_EX_LAYOUTRTL | WS_EX_RTLREADING);
243 dialog_pointer = reinterpret_cast<DLGTEMPLATE*>(rtl_dwords); 256 dialog_pointer = reinterpret_cast<DLGTEMPLATE*>(rtl_dwords);
244 } 257 }
245 258
246 hwnd_ = CreateDialogIndirectParam(module, dialog_pointer, NULL, 259 hwnd_ = CreateDialogIndirectParam(module, dialog_pointer, NULL,
247 DialogProc, reinterpret_cast<LPARAM>(this)); 260 DialogProc, reinterpret_cast<LPARAM>(this));
248 if (!hwnd_) 261 if (!hwnd_)
249 return false; 262 return false;
250 263
251 // Set up handler for Ctrl-Alt-Esc shortcut. 264 // Set up handler for Ctrl-Alt-Esc shortcut.
252 if (!has_hotkey_ && RegisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID, 265 if (!has_hotkey_ && RegisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID,
253 MOD_ALT | MOD_CONTROL, VK_ESCAPE)) { 266 MOD_ALT | MOD_CONTROL, VK_ESCAPE)) {
254 has_hotkey_ = true; 267 has_hotkey_ = true;
255 } 268 }
256 269
257 if (!SetStrings(UTF8ToUTF16(username))) 270 if (!SetStrings())
258 return false; 271 return false;
259 272
260 SetDialogPosition(); 273 SetDialogPosition();
261 ShowWindow(hwnd_, SW_SHOW); 274 ShowWindow(hwnd_, SW_SHOW);
262 return IsWindowVisible(hwnd_) != FALSE; 275 return IsWindowVisible(hwnd_) != FALSE;
263 } 276 }
264 277
265 void DisconnectWindowWin::EndDialog() { 278 void DisconnectWindowWin::EndDialog() {
279 DCHECK(ui_task_runner()->BelongsToCurrentThread());
280
266 if (has_hotkey_) { 281 if (has_hotkey_) {
267 UnregisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID); 282 UnregisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID);
268 has_hotkey_ = false; 283 has_hotkey_ = false;
269 } 284 }
270 285
271 if (hwnd_) { 286 if (hwnd_) {
272 DestroyWindow(hwnd_); 287 DestroyWindow(hwnd_);
273 hwnd_ = NULL; 288 hwnd_ = NULL;
274 } 289 }
275 290
276 if (!disconnect_callback_.is_null()) { 291 caller_task_runner()->PostTask(FROM_HERE, disconnect_callback_);
277 disconnect_callback_.Run();
278 disconnect_callback_.Reset();
279 }
280 } 292 }
281 293
282 void DisconnectWindowWin::SetDialogPosition() { 294 void DisconnectWindowWin::SetDialogPosition() {
295 DCHECK(ui_task_runner()->BelongsToCurrentThread());
296
283 // Try to center the window above the task-bar. If that fails, use the 297 // Try to center the window above the task-bar. If that fails, use the
284 // primary monitor. If that fails (very unlikely), use the default position. 298 // primary monitor. If that fails (very unlikely), use the default position.
285 HWND taskbar = FindWindow(kShellTrayWindowName, NULL); 299 HWND taskbar = FindWindow(kShellTrayWindowName, NULL);
286 HMONITOR monitor = MonitorFromWindow(taskbar, MONITOR_DEFAULTTOPRIMARY); 300 HMONITOR monitor = MonitorFromWindow(taskbar, MONITOR_DEFAULTTOPRIMARY);
287 MONITORINFO monitor_info = {sizeof(monitor_info)}; 301 MONITORINFO monitor_info = {sizeof(monitor_info)};
288 RECT window_rect; 302 RECT window_rect;
289 if (GetMonitorInfo(monitor, &monitor_info) && 303 if (GetMonitorInfo(monitor, &monitor_info) &&
290 GetWindowRect(hwnd_, &window_rect)) { 304 GetWindowRect(hwnd_, &window_rect)) {
291 int window_width = window_rect.right - window_rect.left; 305 int window_width = window_rect.right - window_rect.left;
292 int window_height = window_rect.bottom - window_rect.top; 306 int window_height = window_rect.bottom - window_rect.top;
293 int top = monitor_info.rcWork.bottom - window_height; 307 int top = monitor_info.rcWork.bottom - window_height;
294 int left = (monitor_info.rcWork.right + monitor_info.rcWork.left - 308 int left = (monitor_info.rcWork.right + monitor_info.rcWork.left -
295 window_width) / 2; 309 window_width) / 2;
296 SetWindowPos(hwnd_, NULL, left, top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); 310 SetWindowPos(hwnd_, NULL, left, top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
297 } 311 }
298 } 312 }
299 313
300 bool DisconnectWindowWin::SetStrings(const string16& username) { 314 bool DisconnectWindowWin::SetStrings() {
301 if (!SetWindowText(hwnd_, ui_strings_->product_name.c_str())) 315 DCHECK(ui_task_runner()->BelongsToCurrentThread());
316
317 if (!SetWindowText(hwnd_, ui_strings().product_name.c_str()))
302 return false; 318 return false;
303 319
304 // Localize the disconnect button text and measure length of the old and new 320 // Localize the disconnect button text and measure length of the old and new
305 // labels. 321 // labels.
306 HWND disconnect_button = GetDlgItem(hwnd_, IDC_DISCONNECT); 322 HWND disconnect_button = GetDlgItem(hwnd_, IDC_DISCONNECT);
307 if (!disconnect_button) 323 if (!disconnect_button)
308 return false; 324 return false;
309 int button_old_required_width = GetControlTextWidth(disconnect_button); 325 int button_old_required_width = GetControlTextWidth(disconnect_button);
310 if (!SetWindowText(disconnect_button, 326 if (!SetWindowText(disconnect_button,
311 ui_strings_->disconnect_button_text.c_str())) { 327 ui_strings().disconnect_button_text.c_str())) {
312 return false; 328 return false;
313 } 329 }
314 int button_new_required_width = GetControlTextWidth(disconnect_button); 330 int button_new_required_width = GetControlTextWidth(disconnect_button);
315 int button_width_delta = 331 int button_width_delta =
316 button_new_required_width - button_old_required_width; 332 button_new_required_width - button_old_required_width;
317 333
318 // Format and truncate "Your desktop is shared with ..." message. 334 // Format and truncate "Your desktop is shared with ..." message.
319 string16 text = ReplaceStringPlaceholders(ui_strings_->disconnect_message, 335 string16 text = ReplaceStringPlaceholders(ui_strings().disconnect_message,
320 username, NULL); 336 UTF8ToUTF16(username_), NULL);
321 if (text.length() > kMaxSharingWithTextLength) 337 if (text.length() > kMaxSharingWithTextLength)
322 text.erase(kMaxSharingWithTextLength); 338 text.erase(kMaxSharingWithTextLength);
323 339
324 // Set localized and truncated "Your desktop is shared with ..." message and 340 // Set localized and truncated "Your desktop is shared with ..." message and
325 // measure length of the old and new text. 341 // measure length of the old and new text.
326 HWND sharing_with_label = GetDlgItem(hwnd_, IDC_DISCONNECT_SHARINGWITH); 342 HWND sharing_with_label = GetDlgItem(hwnd_, IDC_DISCONNECT_SHARINGWITH);
327 if (!sharing_with_label) 343 if (!sharing_with_label)
328 return false; 344 return false;
329 int label_old_required_width = GetControlTextWidth(sharing_with_label); 345 int label_old_required_width = GetControlTextWidth(sharing_with_label);
330 if (!SetWindowText(sharing_with_label, text.c_str())) 346 if (!SetWindowText(sharing_with_label, text.c_str()))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 HRGN rgn = CreateRoundRectRgn(0, 0, width, height, kWindowBorderRadius, 394 HRGN rgn = CreateRoundRectRgn(0, 0, width, height, kWindowBorderRadius,
379 kWindowBorderRadius); 395 kWindowBorderRadius);
380 if (!rgn) 396 if (!rgn)
381 return false; 397 return false;
382 if (!SetWindowRgn(hwnd_, rgn, TRUE)) 398 if (!SetWindowRgn(hwnd_, rgn, TRUE))
383 return false; 399 return false;
384 400
385 return true; 401 return true;
386 } 402 }
387 403
388 scoped_ptr<DisconnectWindow> DisconnectWindow::Create( 404 } // namespace
389 const UiStrings* ui_strings) { 405
390 return scoped_ptr<DisconnectWindow>(new DisconnectWindowWin(ui_strings)); 406 scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow(
407 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
408 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
409 const base::Closure& disconnect_callback,
410 const std::string& username,
411 const UiStrings& ui_strings) {
412 scoped_refptr<Core> core = new DisconnectWindowWin(caller_task_runner,
413 ui_task_runner,
414 disconnect_callback,
415 username,
416 ui_strings);
417 return scoped_ptr<HostWindow>(new HostWindow(core));
391 } 418 }
392 419
393 } // namespace remoting 420 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698