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/host_script_object.h" | 5 #include "remoting/host/host_script_object.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 void HostNPScriptObject::OnAccessDenied() { | 278 void HostNPScriptObject::OnAccessDenied() { |
279 DCHECK_EQ(MessageLoop::current(), host_context_.network_message_loop()); | 279 DCHECK_EQ(MessageLoop::current(), host_context_.network_message_loop()); |
280 | 280 |
281 ++failed_login_attempts_; | 281 ++failed_login_attempts_; |
282 if (failed_login_attempts_ == kMaxLoginAttempts) | 282 if (failed_login_attempts_ == kMaxLoginAttempts) |
283 DisconnectInternal(); | 283 DisconnectInternal(); |
284 } | 284 } |
285 | 285 |
| 286 void HostNPScriptObject::OnAuthenticatedClientsChanged(int clients_connected) { |
| 287 DCHECK_NE(base::PlatformThread::CurrentId(), np_thread_id_); |
| 288 OnStateChanged(clients_connected ? kConnected : kDisconnected); |
| 289 } |
| 290 |
286 void HostNPScriptObject::OnShutdown() { | 291 void HostNPScriptObject::OnShutdown() { |
287 DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop()); | 292 DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop()); |
288 | 293 |
289 OnStateChanged(kDisconnected); | 294 OnStateChanged(kDisconnected); |
290 } | 295 } |
291 | 296 |
292 // string uid, string auth_token | 297 // string uid, string auth_token |
293 bool HostNPScriptObject::Connect(const NPVariant* args, | 298 bool HostNPScriptObject::Connect(const NPVariant* args, |
294 uint32_t arg_count, | 299 uint32_t arg_count, |
295 NPVariant* result) { | 300 NPVariant* result) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 task); | 519 task); |
515 } | 520 } |
516 | 521 |
517 void HostNPScriptObject::NPTaskSpringboard(void* task) { | 522 void HostNPScriptObject::NPTaskSpringboard(void* task) { |
518 Task* real_task = reinterpret_cast<Task*>(task); | 523 Task* real_task = reinterpret_cast<Task*>(task); |
519 real_task->Run(); | 524 real_task->Run(); |
520 delete real_task; | 525 delete real_task; |
521 } | 526 } |
522 | 527 |
523 } // namespace remoting | 528 } // namespace remoting |
OLD | NEW |