Chromium Code Reviews| Index: remoting/host/client_session.cc |
| diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
| index 19c3d3677f882f8af30b11e4921317c9228279f5..3e4eb109bbbae5749b0c5039beee2e7f25d7911b 100644 |
| --- a/remoting/host/client_session.cc |
| +++ b/remoting/host/client_session.cc |
| @@ -23,6 +23,8 @@ static const int64 kRemoteBlockTimeoutMillis = 2000; |
| namespace remoting { |
| +using protocol::KeyEvent; |
| + |
| ClientSession::ClientSession( |
| EventHandler* event_handler, |
| UserAuthenticator* user_authenticator, |
| @@ -71,8 +73,7 @@ void ClientSession::OnAuthorizationComplete(bool success) { |
| } |
| } |
| -void ClientSession::InjectKeyEvent(const protocol::KeyEvent* event, |
| - Task* done) { |
| +void ClientSession::InjectKeyEvent(const KeyEvent* event, Task* done) { |
| base::ScopedTaskRunner done_runner(done); |
| if (authenticated_ && !ShouldIgnoreRemoteKeyboardInput(event)) { |
| RecordKeyEvent(event); |
| @@ -155,7 +156,7 @@ bool ClientSession::ShouldIgnoreRemoteMouseInput( |
| } |
| bool ClientSession::ShouldIgnoreRemoteKeyboardInput( |
| - const protocol::KeyEvent* event) const { |
| + const KeyEvent* event) const { |
| // If the host user has not yet approved the continuation of the connection, |
| // then all remote keyboard input is ignored, except to release keys that |
| // were already pressed. |
| @@ -166,7 +167,7 @@ bool ClientSession::ShouldIgnoreRemoteKeyboardInput( |
| return false; |
| } |
| -void ClientSession::RecordKeyEvent(const protocol::KeyEvent* event) { |
| +void ClientSession::RecordKeyEvent(const KeyEvent* event) { |
| if (event->pressed()) { |
| pressed_keys_.insert(event->keycode()); |
| } else { |
| @@ -177,10 +178,10 @@ void ClientSession::RecordKeyEvent(const protocol::KeyEvent* event) { |
| void ClientSession::UnpressKeys() { |
| std::set<int>::iterator i; |
| for (i = pressed_keys_.begin(); i != pressed_keys_.end(); ++i) { |
| - protocol::KeyEvent key; |
| - key.set_keycode(*i); |
| - key.set_pressed(false); |
| - input_stub_->InjectKeyEvent(&key, NULL); |
| + KeyEvent* key = new protocol::KeyEvent(); |
|
Sergey Ulanov
2011/08/30 02:27:39
nit: s/protocol:://
garykac
2011/08/30 16:31:48
Done.
|
| + key->set_keycode(*i); |
| + key->set_pressed(false); |
| + input_stub_->InjectKeyEvent(key, new DeleteTask<KeyEvent>(key)); |
|
Sergey Ulanov
2011/08/30 02:27:39
Please add DCHECK(done_task) in InputSender::Injec
garykac
2011/08/30 16:31:48
Done.
|
| } |
| pressed_keys_.clear(); |
| } |