diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 00:13:38 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 00:13:38 +0000 |
commit | a978d6ddd7e0cc7799bdcc17ece3f0ba4cfdfeff (patch) | |
tree | 075d5b0ed48e61e8cc712fcdcc1f0e1f93c6aed0 /remoting | |
parent | 29c5d02338589b232502ec3dadac4491bc241690 (diff) | |
download | chromium_src-a978d6ddd7e0cc7799bdcc17ece3f0ba4cfdfeff.zip chromium_src-a978d6ddd7e0cc7799bdcc17ece3f0ba4cfdfeff.tar.gz chromium_src-a978d6ddd7e0cc7799bdcc17ece3f0ba4cfdfeff.tar.bz2 |
Close the client session in case if the disconnect window could not be shown for any reason.
BUG=156659
Review URL: https://chromiumcodereview.appspot.com/11531007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/disconnect_window.h | 7 | ||||
-rw-r--r-- | remoting/host/disconnect_window_gtk.cc | 15 | ||||
-rw-r--r-- | remoting/host/disconnect_window_mac.mm | 9 | ||||
-rw-r--r-- | remoting/host/disconnect_window_win.cc | 304 | ||||
-rw-r--r-- | remoting/host/host_mock_objects.h | 2 | ||||
-rw-r--r-- | remoting/host/host_user_interface.cc | 30 | ||||
-rw-r--r-- | remoting/host/host_user_interface.h | 10 |
7 files changed, 229 insertions, 148 deletions
diff --git a/remoting/host/disconnect_window.h b/remoting/host/disconnect_window.h index 739021a..30a61d5 100644 --- a/remoting/host/disconnect_window.h +++ b/remoting/host/disconnect_window.h @@ -27,12 +27,13 @@ class DisconnectWindow { virtual ~DisconnectWindow() {} - // Show the disconnect window allowing the user to shut down the host. - virtual void Show(const UiStrings& ui_strings, + // Shows the disconnect window allowing the user to disconnect the session. + // Returns false if the window could not be shown for any reason. + virtual bool Show(const UiStrings& ui_strings, const DisconnectCallback& disconnect_callback, const std::string& username) = 0; - // Hide the disconnect window. + // Hides the disconnect window. virtual void Hide() = 0; static scoped_ptr<DisconnectWindow> Create(); diff --git a/remoting/host/disconnect_window_gtk.cc b/remoting/host/disconnect_window_gtk.cc index dd81ab45..3a58d35 100644 --- a/remoting/host/disconnect_window_gtk.cc +++ b/remoting/host/disconnect_window_gtk.cc @@ -21,7 +21,7 @@ class DisconnectWindowGtk : public DisconnectWindow { DisconnectWindowGtk(); virtual ~DisconnectWindowGtk(); - virtual void Show(const UiStrings& ui_strings, + virtual bool Show(const UiStrings& ui_strings, const DisconnectCallback& disconnect_callback, const std::string& username) OVERRIDE; virtual void Hide() OVERRIDE; @@ -128,9 +128,13 @@ void DisconnectWindowGtk::CreateWindow(const UiStrings& ui_strings) { gtk_widget_show_all(disconnect_window_); } -void DisconnectWindowGtk::Show(const UiStrings& ui_strings, +bool DisconnectWindowGtk::Show(const UiStrings& ui_strings, const DisconnectCallback& disconnect_callback, const std::string& username) { + DCHECK(disconnect_callback_.is_null()); + DCHECK(!disconnect_callback.is_null()); + DCHECK(!disconnect_window_); + disconnect_callback_ = disconnect_callback; CreateWindow(ui_strings); @@ -138,6 +142,7 @@ void DisconnectWindowGtk::Show(const UiStrings& ui_strings, ui_strings.disconnect_message, UTF8ToUTF16(username), NULL); gtk_label_set_text(GTK_LABEL(message_), UTF16ToUTF8(text).c_str()); gtk_window_present(GTK_WINDOW(disconnect_window_)); + return true; } void DisconnectWindowGtk::Hide() { @@ -145,18 +150,16 @@ void DisconnectWindowGtk::Hide() { gtk_widget_destroy(disconnect_window_); disconnect_window_ = NULL; } + + disconnect_callback_.Reset(); } void DisconnectWindowGtk::OnClicked(GtkWidget* button) { - CHECK(!disconnect_callback_.is_null()); - disconnect_callback_.Run(); Hide(); } gboolean DisconnectWindowGtk::OnDelete(GtkWidget* window, GdkEvent* event) { - CHECK(!disconnect_callback_.is_null()); - disconnect_callback_.Run(); Hide(); diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm index 368debd..723045f 100644 --- a/remoting/host/disconnect_window_mac.mm +++ b/remoting/host/disconnect_window_mac.mm @@ -19,7 +19,7 @@ class DisconnectWindowMac : public remoting::DisconnectWindow { DisconnectWindowMac(); virtual ~DisconnectWindowMac(); - virtual void Show(const UiStrings& ui_strings, + virtual bool Show(const UiStrings& ui_strings, const base::Closure& disconnect_callback, const std::string& username) OVERRIDE; virtual void Hide() OVERRIDE; @@ -38,15 +38,18 @@ DisconnectWindowMac::~DisconnectWindowMac() { [window_controller_ close]; } -void DisconnectWindowMac::Show(const UiStrings& ui_strings, +bool DisconnectWindowMac::Show(const UiStrings& ui_strings, const base::Closure& disconnect_callback, const std::string& username) { - CHECK(window_controller_ == nil); + DCHECK(!disconnect_callback.is_null()); + DCHECK(window_controller_ == nil); + window_controller_ = [[DisconnectWindowController alloc] initWithUiStrings:ui_strings callback:disconnect_callback username:username]; [window_controller_ showWindow:nil]; + return true; } void DisconnectWindowMac::Hide() { diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc index ef4a9dd..a31e11d 100644 --- a/remoting/host/disconnect_window_win.cc +++ b/remoting/host/disconnect_window_win.cc @@ -24,8 +24,13 @@ namespace { const int DISCONNECT_HOTKEY_ID = 1000; -const int kWindowBorderRadius = 14; + +// Maximum length of "Your desktop is shared with ..." message in UTF-16 +// characters. +const size_t kMaxSharingWithTextLength = 100; + const wchar_t kShellTrayWindowName[] = L"Shell_TrayWnd"; +const int kWindowBorderRadius = 14; } // namespace anonymous @@ -36,22 +41,33 @@ class DisconnectWindowWin : public DisconnectWindow { DisconnectWindowWin(); virtual ~DisconnectWindowWin(); - virtual void Show(const UiStrings& ui_strings, + virtual bool Show(const UiStrings& ui_strings, const DisconnectCallback& disconnect_callback, const std::string& username) OVERRIDE; virtual void Hide() OVERRIDE; private: - static BOOL CALLBACK DialogProc(HWND hwmd, UINT msg, WPARAM wParam, - LPARAM lParam); + static BOOL CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam, + LPARAM lparam); BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - void ShutdownHost(); + // Creates the dialog window and registers the disconnect hot key. + bool BeginDialog(const UiStrings& ui_strings, + const std::string& username); + + // Unregisters the disconnect hot key and closed the dialog. void EndDialog(); - void SetStrings(const UiStrings& strings, const std::string& username); + + // Invokes the disconnect callback passed to Show(). + void InvokeDiconnectCallback(); + + // Trys to position the dialog window above the taskbar. void SetDialogPosition(); + // Applies localization string and resizes the dialog. + bool SetStrings(const UiStrings& strings, const string16& username); + DisconnectCallback disconnect_callback_; HWND hwnd_; bool has_hotkey_; @@ -60,6 +76,19 @@ private: DISALLOW_COPY_AND_ASSIGN(DisconnectWindowWin); }; +static int GetControlTextWidth(HWND control) { + RECT rect = {0, 0, 0, 0}; + WCHAR text[256]; + int result = GetWindowText(control, text, arraysize(text)); + if (result) { + base::win::ScopedGetDC dc(control); + base::win::ScopedSelectObject font( + dc, (HFONT)SendMessage(control, WM_GETFONT, 0, 0)); + DrawText(dc, text, -1, &rect, DT_CALCRECT | DT_SINGLELINE); + } + return rect.right; +} + DisconnectWindowWin::DisconnectWindowWin() : hwnd_(NULL), has_hotkey_(false), @@ -71,35 +100,61 @@ DisconnectWindowWin::~DisconnectWindowWin() { EndDialog(); } -BOOL CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) { - DisconnectWindowWin* win = NULL; - if (msg == WM_INITDIALOG) { - win = reinterpret_cast<DisconnectWindowWin*>(lParam); - CHECK(win); - SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)win); +bool DisconnectWindowWin::Show(const UiStrings& ui_strings, + const DisconnectCallback& disconnect_callback, + const std::string& username) { + DCHECK(disconnect_callback_.is_null()); + DCHECK(!disconnect_callback.is_null()); + + disconnect_callback_ = disconnect_callback; + + if (BeginDialog(ui_strings, username)) { + return true; } else { - LONG_PTR lp = GetWindowLongPtr(hwnd, DWLP_USER); - win = reinterpret_cast<DisconnectWindowWin*>(lp); + EndDialog(); + return false; } - if (win == NULL) - return FALSE; - return win->OnDialogMessage(hwnd, msg, wParam, lParam); } -BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam) { - switch (msg) { +void DisconnectWindowWin::Hide() { + EndDialog(); +} + +BOOL CALLBACK DisconnectWindowWin::DialogProc(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) { + LONG_PTR self = NULL; + if (message == WM_INITDIALOG) { + self = lparam; + + // Store |this| to the window's user data. + SetLastError(ERROR_SUCCESS); + LONG_PTR result = SetWindowLongPtr(hwnd, DWLP_USER, self); + if (result == 0 && GetLastError() != ERROR_SUCCESS) + reinterpret_cast<DisconnectWindowWin*>(self)->EndDialog(); + } else { + self = GetWindowLongPtr(hwnd, DWLP_USER); + } + + if (self) { + return reinterpret_cast<DisconnectWindowWin*>(self)->OnDialogMessage( + hwnd, message, wparam, lparam); + } + return FALSE; +} + +BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) { + switch (message) { // Ignore close messages. case WM_CLOSE: return TRUE; // Handle the Disconnect button. case WM_COMMAND: - switch (LOWORD(wParam)) { + switch (LOWORD(wparam)) { case IDC_DISCONNECT: EndDialog(); - ShutdownHost(); + InvokeDiconnectCallback(); return TRUE; } return FALSE; @@ -111,7 +166,7 @@ BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT msg, // Ensure the dialog stays visible if the work area dimensions change. case WM_SETTINGCHANGE: - if (wParam == SPI_SETWORKAREA) + if (wparam == SPI_SETWORKAREA) SetDialogPosition(); return TRUE; @@ -123,7 +178,7 @@ BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT msg, // Handle the disconnect hot-key. case WM_HOTKEY: EndDialog(); - ShutdownHost(); + InvokeDiconnectCallback(); return TRUE; // Let the window be draggable by its client area by responding @@ -150,27 +205,30 @@ BOOL DisconnectWindowWin::OnDialogMessage(HWND hwnd, UINT msg, return FALSE; } -void DisconnectWindowWin::Show(const UiStrings& ui_strings, - const DisconnectCallback& disconnect_callback, - const std::string& username) { - CHECK(!hwnd_); - disconnect_callback_ = disconnect_callback; +bool DisconnectWindowWin::BeginDialog(const UiStrings& ui_strings, + const std::string& username) { + DCHECK(!hwnd_); // Load the dialog resource so that we can modify the RTL flags if necessary. HMODULE module = base::GetModuleFromAddress(&DialogProc); HRSRC dialog_resource = FindResource(module, MAKEINTRESOURCE(IDD_DISCONNECT), RT_DIALOG); - CHECK(dialog_resource); + if (!dialog_resource) + return false; + HGLOBAL dialog_template = LoadResource(module, dialog_resource); - CHECK(dialog_template); + if (!dialog_template) + return false; + DLGTEMPLATE* dialog_pointer = reinterpret_cast<DLGTEMPLATE*>(LockResource(dialog_template)); - CHECK(dialog_pointer); + if (!dialog_pointer) + return false; // The actual resource type is DLGTEMPLATEEX, but this is not defined in any // standard headers, so we treat it as a generic pointer and manipulate the // correct offsets explicitly. - scoped_ptr<unsigned char> rtl_dialog_template; + scoped_array<unsigned char> rtl_dialog_template; if (ui_strings.direction == UiStrings::RTL) { unsigned long dialog_template_size = SizeofResource(module, dialog_resource); @@ -182,8 +240,9 @@ void DisconnectWindowWin::Show(const UiStrings& ui_strings, } hwnd_ = CreateDialogIndirectParam(module, dialog_pointer, NULL, - (DLGPROC)DialogProc, (LPARAM)this); - CHECK(hwnd_); + DialogProc, reinterpret_cast<LPARAM>(this)); + if (!hwnd_) + return false; // Set up handler for Ctrl-Alt-Esc shortcut. if (!has_hotkey_ && RegisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID, @@ -191,78 +250,30 @@ void DisconnectWindowWin::Show(const UiStrings& ui_strings, has_hotkey_ = true; } - SetStrings(ui_strings, username); + if (!SetStrings(ui_strings, UTF8ToUTF16(username))) + return false; + SetDialogPosition(); ShowWindow(hwnd_, SW_SHOW); + return IsWindowVisible(hwnd_) != FALSE; } -void DisconnectWindowWin::ShutdownHost() { - CHECK(!disconnect_callback_.is_null()); - disconnect_callback_.Run(); -} - -static int GetControlTextWidth(HWND control) { - RECT rect = {0, 0, 0, 0}; - WCHAR text[256]; - int result = GetWindowText(control, text, arraysize(text)); - if (result) { - base::win::ScopedGetDC dc(control); - base::win::ScopedSelectObject font( - dc, (HFONT)SendMessage(control, WM_GETFONT, 0, 0)); - DrawText(dc, text, -1, &rect, DT_CALCRECT|DT_SINGLELINE); +void DisconnectWindowWin::EndDialog() { + if (has_hotkey_) { + UnregisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID); + has_hotkey_ = false; } - return rect.right; -} -void DisconnectWindowWin::SetStrings(const UiStrings& ui_strings, - const std::string& username) { - SetWindowText(hwnd_, ui_strings.product_name.c_str()); - - HWND hwndButton = GetDlgItem(hwnd_, IDC_DISCONNECT); - CHECK(hwndButton); - int button_old_required_width = GetControlTextWidth(hwndButton); - SetWindowText(hwndButton, ui_strings.disconnect_button_text.c_str()); - int button_new_required_width = GetControlTextWidth(hwndButton); - - HWND hwndSharingWith = GetDlgItem(hwnd_, IDC_DISCONNECT_SHARINGWITH); - CHECK(hwndSharingWith); - string16 text = ReplaceStringPlaceholders( - ui_strings.disconnect_message, UTF8ToUTF16(username), NULL); - int label_old_required_width = GetControlTextWidth(hwndSharingWith); - SetWindowText(hwndSharingWith, text.c_str()); - int label_new_required_width = GetControlTextWidth(hwndSharingWith); - - int label_width_delta = label_new_required_width - label_old_required_width; - int button_width_delta = - button_new_required_width - button_old_required_width; - - // Reposition the controls such that the label lies to the left of the - // disconnect button (assuming LTR layout). The dialog template determines - // the controls' spacing; update their size to fit the localized content. - RECT label_rect; - GetClientRect(hwndSharingWith, &label_rect); - SetWindowPos(hwndSharingWith, NULL, 0, 0, - label_rect.right + label_width_delta, label_rect.bottom, - SWP_NOMOVE|SWP_NOZORDER); + if (hwnd_) { + ::DestroyWindow(hwnd_); + hwnd_ = NULL; + } - RECT button_rect; - GetWindowRect(hwndButton, &button_rect); - int button_width = button_rect.right - button_rect.left; - int button_height = button_rect.bottom - button_rect.top; - MapWindowPoints(NULL, hwnd_, reinterpret_cast<LPPOINT>(&button_rect), 2); - SetWindowPos(hwndButton, NULL, - button_rect.left + label_width_delta, button_rect.top, - button_width + button_width_delta, button_height, SWP_NOZORDER); + disconnect_callback_.Reset(); +} - RECT window_rect; - GetWindowRect(hwnd_, &window_rect); - int width = (window_rect.right - window_rect.left) + - button_width_delta + label_width_delta; - int height = window_rect.bottom - window_rect.top; - SetWindowPos(hwnd_, NULL, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER); - HRGN rgn = CreateRoundRectRgn(0, 0, width, height, kWindowBorderRadius, - kWindowBorderRadius); - SetWindowRgn(hwnd_, rgn, TRUE); +void DisconnectWindowWin::InvokeDiconnectCallback() { + disconnect_callback_.Run(); } void DisconnectWindowWin::SetDialogPosition() { @@ -283,20 +294,93 @@ void DisconnectWindowWin::SetDialogPosition() { } } -void DisconnectWindowWin::Hide() { - EndDialog(); -} +bool DisconnectWindowWin::SetStrings(const UiStrings& ui_strings, + const string16& username) { + if (!SetWindowText(hwnd_, ui_strings.product_name.c_str())) + return false; + + // Localize the disconnect button text and measure length of the old and new + // labels. + HWND disconnect_button = GetDlgItem(hwnd_, IDC_DISCONNECT); + if (!disconnect_button) + return false; + int button_old_required_width = GetControlTextWidth(disconnect_button); + if (!SetWindowText(disconnect_button, + ui_strings.disconnect_button_text.c_str())) { + return false; + } + int button_new_required_width = GetControlTextWidth(disconnect_button); + int button_width_delta = + button_new_required_width - button_old_required_width; -void DisconnectWindowWin::EndDialog() { - if (has_hotkey_) { - UnregisterHotKey(hwnd_, DISCONNECT_HOTKEY_ID); - has_hotkey_ = false; + // Format and truncate "Your desktop is shared with ..." message. + string16 text = ReplaceStringPlaceholders(ui_strings.disconnect_message, + username, NULL); + if (text.length() > kMaxSharingWithTextLength) + text.erase(kMaxSharingWithTextLength); + + // Set localized and truncated "Your desktop is shared with ..." message and + // measure length of the old and new text. + HWND sharing_with_label = GetDlgItem(hwnd_, IDC_DISCONNECT_SHARINGWITH); + if (!sharing_with_label) + return false; + int label_old_required_width = GetControlTextWidth(sharing_with_label); + if (!SetWindowText(sharing_with_label, text.c_str())) + return false; + int label_new_required_width = GetControlTextWidth(sharing_with_label); + int label_width_delta = label_new_required_width - label_old_required_width; + + // Reposition the controls such that the label lies to the left of the + // disconnect button (assuming LTR layout). The dialog template determines + // the controls' spacing; update their size to fit the localized content. + RECT label_rect; + if (!GetClientRect(sharing_with_label, &label_rect)) + return false; + if (!SetWindowPos(sharing_with_label, NULL, 0, 0, + label_rect.right + label_width_delta, label_rect.bottom, + SWP_NOMOVE | SWP_NOZORDER)) { + return false; } - if (hwnd_) { - ::DestroyWindow(hwnd_); - hwnd_ = NULL; + // Reposition the disconnect button as well. + RECT button_rect; + if (!GetWindowRect(disconnect_button, &button_rect)) + return false; + int button_width = button_rect.right - button_rect.left; + int button_height = button_rect.bottom - button_rect.top; + SetLastError(ERROR_SUCCESS); + int result = MapWindowPoints(HWND_DESKTOP, hwnd_, + reinterpret_cast<LPPOINT>(&button_rect), 2); + if (!result && GetLastError() != ERROR_SUCCESS) + return false; + if (!SetWindowPos(disconnect_button, NULL, + button_rect.left + label_width_delta, button_rect.top, + button_width + button_width_delta, button_height, + SWP_NOZORDER)) { + return false; + } + + // Resize the whole window to fit the resized controls. + RECT window_rect; + if (!GetWindowRect(hwnd_, &window_rect)) + return false; + int width = (window_rect.right - window_rect.left) + + button_width_delta + label_width_delta; + int height = window_rect.bottom - window_rect.top; + if (!SetWindowPos(hwnd_, NULL, 0, 0, width, height, + SWP_NOMOVE | SWP_NOZORDER)) { + return false; } + + // Make the corners of the disconnect window rounded. + HRGN rgn = CreateRoundRectRgn(0, 0, width, height, kWindowBorderRadius, + kWindowBorderRadius); + if (!rgn) + return false; + if (!SetWindowRgn(hwnd_, rgn, TRUE)) + return false; + + return true; } scoped_ptr<DisconnectWindow> DisconnectWindow::Create() { diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h index 6c24bd2..725a7d1 100644 --- a/remoting/host/host_mock_objects.h +++ b/remoting/host/host_mock_objects.h @@ -59,7 +59,7 @@ class MockDisconnectWindow : public DisconnectWindow { MockDisconnectWindow(); virtual ~MockDisconnectWindow(); - MOCK_METHOD3(Show, void(const UiStrings& ui_strings, + MOCK_METHOD3(Show, bool(const UiStrings& ui_strings, const DisconnectCallback& disconnect_callback, const std::string& username)); MOCK_METHOD0(Hide, void()); diff --git a/remoting/host/host_user_interface.cc b/remoting/host/host_user_interface.cc index ecd1b87..71f6b07 100644 --- a/remoting/host/host_user_interface.cc +++ b/remoting/host/host_user_interface.cc @@ -27,7 +27,7 @@ HostUserInterface::~HostUserInterface() { DCHECK(ui_task_runner_->BelongsToCurrentThread()); MonitorLocalInputs(false); - ShowDisconnectWindow(false, std::string()); + disconnect_window_->Hide(); } void HostUserInterface::Init() { @@ -84,7 +84,7 @@ void HostUserInterface::OnDisconnectCallback() { DCHECK(ui_task_runner_->BelongsToCurrentThread()); MonitorLocalInputs(false); - ShowDisconnectWindow(false, std::string()); + disconnect_window_->Hide(); DisconnectSession(); } @@ -106,15 +106,23 @@ void HostUserInterface::ProcessOnClientAuthenticated( const std::string& username) { DCHECK(ui_task_runner_->BelongsToCurrentThread()); + if (!disconnect_window_->Show( + host_->ui_strings(), + base::Bind(&HostUserInterface::OnDisconnectCallback, weak_ptr_), + username)) { + LOG(ERROR) << "Failed to show the disconnect window."; + DisconnectSession(); + return; + } + MonitorLocalInputs(true); - ShowDisconnectWindow(true, username); } void HostUserInterface::ProcessOnClientDisconnected() { DCHECK(ui_task_runner_->BelongsToCurrentThread()); MonitorLocalInputs(false); - ShowDisconnectWindow(false, std::string()); + disconnect_window_->Hide(); } void HostUserInterface::MonitorLocalInputs(bool enable) { @@ -130,18 +138,4 @@ void HostUserInterface::MonitorLocalInputs(bool enable) { } } -void HostUserInterface::ShowDisconnectWindow(bool show, - const std::string& username) { - DCHECK(ui_task_runner_->BelongsToCurrentThread()); - - if (show) { - disconnect_window_->Show( - host_->ui_strings(), - base::Bind(&HostUserInterface::OnDisconnectCallback, weak_ptr_), - username); - } else { - disconnect_window_->Hide(); - } -} - } // namespace remoting diff --git a/remoting/host/host_user_interface.h b/remoting/host/host_user_interface.h index f4d3f60..3a89a06 100644 --- a/remoting/host/host_user_interface.h +++ b/remoting/host/host_user_interface.h @@ -36,9 +36,9 @@ class HostUserInterface : public HostStatusObserver { // Init must be called from |ui_task_runner_|. virtual void Init(); - // Start the HostUserInterface for |host|. |disconnect_callback| will be - // called on |ui_task_runner| when |host| is shut down. |host| must remain - // valid at least until ChromotingHost::Shutdown() completes. + // Start the HostUserInterface for |host|. |disconnect_callback| will be + // called on |ui_task_runner| to notify the caller that the connection should + // be disconnected. |host| must remain valid until OnShutdown() is called. // Start must be called from |network_task_runner_|. virtual void Start(ChromotingHost* host, const base::Closure& disconnect_callback); @@ -84,10 +84,6 @@ class HostUserInterface : public HostStatusObserver { void MonitorLocalInputs(bool enable); - // Show or hide the Disconnect window on the UI thread. If |show| is false, - // hide the window, ignoring the |username| parameter. - void ShowDisconnectWindow(bool show, const std::string& username); - // The JID of the currently-authenticated user (or an empty string if no user // is connected). std::string authenticated_jid_; |