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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 9465035: Move ClientSession's input logic into separate components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move mouse state tracking to InputEventTracker. Created 8 years, 9 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
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/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 19 matching lines...) Expand all
30 #include "remoting/client/chromoting_client.h" 30 #include "remoting/client/chromoting_client.h"
31 #include "remoting/client/frame_consumer_proxy.h" 31 #include "remoting/client/frame_consumer_proxy.h"
32 #include "remoting/client/mouse_input_filter.h" 32 #include "remoting/client/mouse_input_filter.h"
33 #include "remoting/client/plugin/chromoting_scriptable_object.h" 33 #include "remoting/client/plugin/chromoting_scriptable_object.h"
34 #include "remoting/client/plugin/pepper_input_handler.h" 34 #include "remoting/client/plugin/pepper_input_handler.h"
35 #include "remoting/client/plugin/pepper_view.h" 35 #include "remoting/client/plugin/pepper_view.h"
36 #include "remoting/client/plugin/pepper_xmpp_proxy.h" 36 #include "remoting/client/plugin/pepper_xmpp_proxy.h"
37 #include "remoting/client/rectangle_update_decoder.h" 37 #include "remoting/client/rectangle_update_decoder.h"
38 #include "remoting/protocol/connection_to_host.h" 38 #include "remoting/protocol/connection_to_host.h"
39 #include "remoting/protocol/host_stub.h" 39 #include "remoting/protocol/host_stub.h"
40 #include "remoting/protocol/key_event_tracker.h" 40 #include "remoting/protocol/input_event_tracker.h"
41 41
42 // Windows defines 'PostMessage', so we have to undef it. 42 // Windows defines 'PostMessage', so we have to undef it.
43 #if defined(PostMessage) 43 #if defined(PostMessage)
44 #undef PostMessage 44 #undef PostMessage
45 #endif 45 #endif
46 46
47 namespace remoting { 47 namespace remoting {
48 48
49 namespace { 49 namespace {
50 50
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 host_connection_.reset(new protocol::ConnectionToHost( 334 host_connection_.reset(new protocol::ConnectionToHost(
335 context_.network_message_loop(), this, true)); 335 context_.network_message_loop(), this, true));
336 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), 336 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(),
337 view_.get(), rectangle_decoder_.get(), 337 view_.get(), rectangle_decoder_.get(),
338 base::Closure())); 338 base::Closure()));
339 339
340 // Construct the input pipeline 340 // Construct the input pipeline
341 mouse_input_filter_.reset( 341 mouse_input_filter_.reset(
342 new MouseInputFilter(host_connection_->input_stub())); 342 new MouseInputFilter(host_connection_->input_stub()));
343 mouse_input_filter_->set_input_size(view_->get_view_size()); 343 mouse_input_filter_->set_input_size(view_->get_view_size());
344 key_event_tracker_.reset( 344 input_tracker_.reset(
345 new protocol::KeyEventTracker(mouse_input_filter_.get())); 345 new protocol::InputEventTracker(mouse_input_filter_.get()));
346 input_handler_.reset( 346 input_handler_.reset(
347 new PepperInputHandler(key_event_tracker_.get())); 347 new PepperInputHandler(input_tracker_.get()));
348 348
349 LOG(INFO) << "Connecting to " << config.host_jid 349 LOG(INFO) << "Connecting to " << config.host_jid
350 << ". Local jid: " << config.local_jid << "."; 350 << ". Local jid: " << config.local_jid << ".";
351 351
352 // Setup the XMPP Proxy. 352 // Setup the XMPP Proxy.
353 xmpp_proxy_ = new PepperXmppProxy( 353 xmpp_proxy_ = new PepperXmppProxy(
354 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), 354 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()),
355 plugin_message_loop_, 355 plugin_message_loop_,
356 context_.network_message_loop()); 356 context_.network_message_loop());
357 357
(...skipping 16 matching lines...) Expand all
374 if (client_.get()) { 374 if (client_.get()) {
375 // TODO(sergeyu): Should we disconnect asynchronously? 375 // TODO(sergeyu): Should we disconnect asynchronously?
376 base::WaitableEvent done_event(true, false); 376 base::WaitableEvent done_event(true, false);
377 client_->Stop(base::Bind(&base::WaitableEvent::Signal, 377 client_->Stop(base::Bind(&base::WaitableEvent::Signal,
378 base::Unretained(&done_event))); 378 base::Unretained(&done_event)));
379 done_event.Wait(); 379 done_event.Wait();
380 client_.reset(); 380 client_.reset();
381 } 381 }
382 382
383 input_handler_.reset(); 383 input_handler_.reset();
384 key_event_tracker_.reset(); 384 input_tracker_.reset();
385 mouse_input_filter_.reset(); 385 mouse_input_filter_.reset();
386 host_connection_.reset(); 386 host_connection_.reset();
387 387
388 SetConnectionState(STATE_CLOSED, ERROR_NONE); 388 SetConnectionState(STATE_CLOSED, ERROR_NONE);
389 } 389 }
390 390
391 void ChromotingInstance::OnIncomingIq(const std::string& iq) { 391 void ChromotingInstance::OnIncomingIq(const std::string& iq) {
392 xmpp_proxy_->OnIq(iq); 392 xmpp_proxy_->OnIq(iq);
393 } 393 }
394 394
395 void ChromotingInstance::ReleaseAllKeys() { 395 void ChromotingInstance::ReleaseAllKeys() {
396 if (key_event_tracker_.get()) { 396 if (input_tracker_.get()) {
397 key_event_tracker_->ReleaseAllKeys(); 397 input_tracker_->ReleaseAll();
398 } 398 }
399 } 399 }
400 400
401 ChromotingStats* ChromotingInstance::GetStats() { 401 ChromotingStats* ChromotingInstance::GetStats() {
402 if (!client_.get()) 402 if (!client_.get())
403 return NULL; 403 return NULL;
404 return client_->GetStats(); 404 return client_->GetStats();
405 } 405 }
406 406
407 void ChromotingInstance::PostChromotingMessage( 407 void ChromotingInstance::PostChromotingMessage(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 539 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
540 data->SetString("message", message); 540 data->SetString("message", message);
541 PostChromotingMessage("logDebugMessage", data.Pass()); 541 PostChromotingMessage("logDebugMessage", data.Pass());
542 542
543 scriptable_object->LogDebugInfo(message); 543 scriptable_object->LogDebugInfo(message);
544 } 544 }
545 g_logging_to_plugin = false; 545 g_logging_to_plugin = false;
546 } 546 }
547 547
548 } // namespace remoting 548 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698