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

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

Issue 10447041: Fix Ctrl+Alt+Esc keyboard shortcut in Me2Me host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « remoting/host/host_user_interface.h ('k') | remoting/host/local_input_monitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/host_user_interface.h" 5 #include "remoting/host/host_user_interface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "remoting/host/chromoting_host.h" 8 #include "remoting/host/chromoting_host.h"
9 #include "remoting/host/chromoting_host_context.h" 9 #include "remoting/host/chromoting_host_context.h"
10 #include "remoting/host/disconnect_window.h" 10 #include "remoting/host/disconnect_window.h"
11 #include "remoting/host/local_input_monitor.h" 11 #include "remoting/host/local_input_monitor.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 HostUserInterface::HostUserInterface(ChromotingHostContext* context) 15 HostUserInterface::HostUserInterface(ChromotingHostContext* context)
16 : host_(NULL), 16 : host_(NULL),
17 context_(context), 17 context_(context),
18 is_monitoring_local_inputs_(false), 18 is_monitoring_local_inputs_(false),
19 ui_thread_proxy_(context->ui_message_loop()), 19 ui_thread_proxy_(context->ui_message_loop()) {
20 disable_disconnect_shortcut_on_mac_(false) {
21 } 20 }
22 21
23 HostUserInterface::~HostUserInterface() { 22 HostUserInterface::~HostUserInterface() {
24 DCHECK(ui_message_loop()->BelongsToCurrentThread()); 23 DCHECK(ui_message_loop()->BelongsToCurrentThread());
25 24
26 MonitorLocalInputs(false); 25 MonitorLocalInputs(false);
27 ShowDisconnectWindow(false, std::string()); 26 ShowDisconnectWindow(false, std::string());
28 27
29 ui_thread_proxy_.Detach(); 28 ui_thread_proxy_.Detach();
30 } 29 }
31 30
32 void HostUserInterface::Start(ChromotingHost* host, 31 void HostUserInterface::Start(ChromotingHost* host,
33 const base::Closure& disconnect_callback) { 32 const base::Closure& disconnect_callback) {
34 DCHECK(network_message_loop()->BelongsToCurrentThread()); 33 DCHECK(network_message_loop()->BelongsToCurrentThread());
35 DCHECK(host_ == NULL); 34 DCHECK(host_ == NULL);
36 DCHECK(disconnect_callback_.is_null()); 35 DCHECK(disconnect_callback_.is_null());
37 36
38 host_ = host; 37 host_ = host;
39 disconnect_callback_ = disconnect_callback; 38 disconnect_callback_ = disconnect_callback;
40 disconnect_window_ = DisconnectWindow::Create(); 39 disconnect_window_ = DisconnectWindow::Create();
41 local_input_monitor_ = LocalInputMonitor::Create(); 40 local_input_monitor_ = LocalInputMonitor::Create();
42 host_->AddStatusObserver(this); 41 host_->AddStatusObserver(this);
43 } 42 }
44 43
45 void HostUserInterface::DisableDisconnectShortcutOnMac() {
46 disable_disconnect_shortcut_on_mac_ = true;
47 }
48
49 void HostUserInterface::OnClientAuthenticated(const std::string& jid) { 44 void HostUserInterface::OnClientAuthenticated(const std::string& jid) {
50 authenticated_jid_ = jid; 45 authenticated_jid_ = jid;
51 46
52 std::string username = jid.substr(0, jid.find('/')); 47 std::string username = jid.substr(0, jid.find('/'));
53 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( 48 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind(
54 &HostUserInterface::ProcessOnClientAuthenticated, 49 &HostUserInterface::ProcessOnClientAuthenticated,
55 base::Unretained(this), username)); 50 base::Unretained(this), username));
56 } 51 }
57 52
58 void HostUserInterface::OnClientDisconnected(const std::string& jid) { 53 void HostUserInterface::OnClientDisconnected(const std::string& jid) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 disconnect_callback_ = disconnect_callback; 117 disconnect_callback_ = disconnect_callback;
123 disconnect_window_ = disconnect_window.Pass(); 118 disconnect_window_ = disconnect_window.Pass();
124 local_input_monitor_ = local_input_monitor.Pass(); 119 local_input_monitor_ = local_input_monitor.Pass();
125 } 120 }
126 121
127 void HostUserInterface::MonitorLocalInputs(bool enable) { 122 void HostUserInterface::MonitorLocalInputs(bool enable) {
128 DCHECK(ui_message_loop()->BelongsToCurrentThread()); 123 DCHECK(ui_message_loop()->BelongsToCurrentThread());
129 124
130 if (enable != is_monitoring_local_inputs_) { 125 if (enable != is_monitoring_local_inputs_) {
131 if (enable) { 126 if (enable) {
132 local_input_monitor_->Start(host_); 127 local_input_monitor_->Start(host_, disconnect_callback_);
133 if (disable_disconnect_shortcut_on_mac_) {
134 local_input_monitor_->DisableShortcutOnMac();
135 }
136 } else { 128 } else {
137 local_input_monitor_->Stop(); 129 local_input_monitor_->Stop();
138 } 130 }
139 is_monitoring_local_inputs_ = enable; 131 is_monitoring_local_inputs_ = enable;
140 } 132 }
141 } 133 }
142 134
143 void HostUserInterface::ShowDisconnectWindow(bool show, 135 void HostUserInterface::ShowDisconnectWindow(bool show,
144 const std::string& username) { 136 const std::string& username) {
145 DCHECK(ui_message_loop()->BelongsToCurrentThread()); 137 DCHECK(ui_message_loop()->BelongsToCurrentThread());
146 138
147 if (show) { 139 if (show) {
148 disconnect_window_->Show( 140 disconnect_window_->Show(
149 host_, 141 host_,
150 base::Bind(&HostUserInterface::OnDisconnectCallback, 142 base::Bind(&HostUserInterface::OnDisconnectCallback,
151 base::Unretained(this)), 143 base::Unretained(this)),
152 username); 144 username);
153 } else { 145 } else {
154 disconnect_window_->Hide(); 146 disconnect_window_->Hide();
155 } 147 }
156 } 148 }
157 149
158 } // namespace remoting 150 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_user_interface.h ('k') | remoting/host/local_input_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698