Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/it2me_host_user_interface.h" | 5 #include "remoting/host/it2me_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/continue_window.h" | 10 #include "remoting/host/continue_window.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 void It2MeHostUserInterface::OnSignallingDisconnected() { | 59 void It2MeHostUserInterface::OnSignallingDisconnected() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 void It2MeHostUserInterface::OnClientAuthenticated(const std::string& jid) { | 62 void It2MeHostUserInterface::OnClientAuthenticated(const std::string& jid) { |
| 63 // There should not be more than one concurrent authenticated connection. | 63 // There should not be more than one concurrent authenticated connection. |
| 64 DCHECK(authenticated_jid_.empty()); | 64 DCHECK(authenticated_jid_.empty()); |
| 65 authenticated_jid_ = jid; | 65 authenticated_jid_ = jid; |
| 66 | 66 |
| 67 std::string username = jid.substr(0, jid.find('/')); | 67 std::string username = jid.substr(0, jid.find('/')); |
| 68 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( | 68 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| 69 &It2MeHostUserInterface::ProcessOnConnect, base::Unretained(this), | 69 &It2MeHostUserInterface::ProcessOnClientAuthenticated, |
| 70 base::Unretained(this), | |
| 70 username)); | 71 username)); |
|
Sergey Ulanov
2011/12/01 21:14:16
nit: this parameter can be moved to the previous l
| |
| 71 } | 72 } |
| 72 | 73 |
| 73 void It2MeHostUserInterface::OnClientDisconnected(const std::string& jid) { | 74 void It2MeHostUserInterface::OnClientDisconnected(const std::string& jid) { |
| 74 if (jid == authenticated_jid_) { | 75 if (jid == authenticated_jid_) { |
| 75 authenticated_jid_.clear(); | 76 authenticated_jid_.clear(); |
| 76 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( | 77 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( |
| 77 &It2MeHostUserInterface::ProcessOnLastDisconnect, | 78 &It2MeHostUserInterface::ProcessOnClientDisconnected, |
| 78 base::Unretained(this))); | 79 base::Unretained(this))); |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 82 void It2MeHostUserInterface::OnAccessDenied() { | 83 void It2MeHostUserInterface::OnAccessDenied() { |
| 83 } | 84 } |
| 84 | 85 |
| 85 void It2MeHostUserInterface::OnShutdown() { | 86 void It2MeHostUserInterface::OnShutdown() { |
| 86 } | 87 } |
| 87 | 88 |
| 88 void It2MeHostUserInterface::Shutdown() { | 89 void It2MeHostUserInterface::Shutdown() { |
| 89 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); | 90 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| 90 | 91 |
| 91 MonitorLocalInputs(false); | 92 MonitorLocalInputs(false); |
| 92 ShowDisconnectWindow(false, std::string()); | 93 ShowDisconnectWindow(false, std::string()); |
| 93 ShowContinueWindow(false); | 94 ShowContinueWindow(false); |
| 94 StartContinueWindowTimer(false); | 95 StartContinueWindowTimer(false); |
| 95 | 96 |
| 96 ui_thread_proxy_.Detach(); | 97 ui_thread_proxy_.Detach(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 void It2MeHostUserInterface::OnConnect(const std::string& username) { | 100 void It2MeHostUserInterface::ProcessOnClientAuthenticated( |
| 100 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( | 101 const std::string& username) { |
| 101 &It2MeHostUserInterface::ProcessOnConnect, base::Unretained(this), | |
| 102 username)); | |
| 103 } | |
| 104 | |
| 105 void It2MeHostUserInterface::OnLastDisconnect() { | |
| 106 ui_thread_proxy_.PostTask(FROM_HERE, base::Bind( | |
| 107 &It2MeHostUserInterface::ProcessOnLastDisconnect, | |
| 108 base::Unretained(this))); | |
| 109 } | |
| 110 | |
| 111 void It2MeHostUserInterface::ProcessOnConnect(const std::string& username) { | |
| 112 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); | 102 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| 113 | 103 |
| 114 MonitorLocalInputs(true); | 104 MonitorLocalInputs(true); |
| 115 ShowDisconnectWindow(true, username); | 105 ShowDisconnectWindow(true, username); |
| 116 StartContinueWindowTimer(true); | 106 StartContinueWindowTimer(true); |
| 117 } | 107 } |
| 118 | 108 |
| 119 void It2MeHostUserInterface::ProcessOnLastDisconnect() { | 109 void It2MeHostUserInterface::ProcessOnClientDisconnected() { |
| 120 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); | 110 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| 121 | 111 |
| 122 MonitorLocalInputs(false); | 112 MonitorLocalInputs(false); |
| 123 ShowDisconnectWindow(false, std::string()); | 113 ShowDisconnectWindow(false, std::string()); |
| 124 ShowContinueWindow(false); | 114 ShowContinueWindow(false); |
| 125 StartContinueWindowTimer(false); | 115 StartContinueWindowTimer(false); |
| 126 } | 116 } |
| 127 | 117 |
| 128 void It2MeHostUserInterface::MonitorLocalInputs(bool enable) { | 118 void It2MeHostUserInterface::MonitorLocalInputs(bool enable) { |
| 129 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); | 119 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 } | 190 } |
| 201 | 191 |
| 202 void It2MeHostUserInterface::OnShutdownHostTimer() { | 192 void It2MeHostUserInterface::OnShutdownHostTimer() { |
| 203 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); | 193 DCHECK(context_->ui_message_loop()->BelongsToCurrentThread()); |
| 204 | 194 |
| 205 ShowContinueWindow(false); | 195 ShowContinueWindow(false); |
| 206 host_->Shutdown(base::Closure()); | 196 host_->Shutdown(base::Closure()); |
| 207 } | 197 } |
| 208 | 198 |
| 209 } // namespace remoting | 199 } // namespace remoting |
| OLD | NEW |