OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 ConnectWithConfig(config, local_jid); | 597 ConnectWithConfig(config, local_jid); |
598 } | 598 } |
599 | 599 |
600 void ChromotingInstance::ConnectWithConfig(const ClientConfig& config, | 600 void ChromotingInstance::ConnectWithConfig(const ClientConfig& config, |
601 const std::string& local_jid) { | 601 const std::string& local_jid) { |
602 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 602 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
603 | 603 |
604 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 604 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
605 | 605 |
| 606 |
| 607 view_.reset(new PepperView(this, &context_)); |
| 608 view_weak_factory_.reset( |
| 609 new base::WeakPtrFactory<FrameConsumer>(view_.get())); |
| 610 |
606 // RectangleUpdateDecoder runs on a separate thread so for now we wrap | 611 // RectangleUpdateDecoder runs on a separate thread so for now we wrap |
607 // PepperView with a ref-counted proxy object. | 612 // PepperView with a ref-counted proxy object. |
608 scoped_refptr<FrameConsumerProxy> consumer_proxy = | 613 scoped_refptr<FrameConsumerProxy> consumer_proxy = |
609 new FrameConsumerProxy(plugin_task_runner_); | 614 new FrameConsumerProxy(plugin_task_runner_, |
| 615 view_weak_factory_->GetWeakPtr()); |
610 | 616 |
611 host_connection_.reset(new protocol::ConnectionToHost(true)); | 617 host_connection_.reset(new protocol::ConnectionToHost(true)); |
612 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); | 618 scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); |
613 client_.reset(new ChromotingClient(config, &context_, | 619 client_.reset(new ChromotingClient(config, &context_, |
614 host_connection_.get(), this, | 620 host_connection_.get(), this, |
615 consumer_proxy, audio_player.Pass())); | 621 consumer_proxy, audio_player.Pass())); |
616 | 622 |
617 view_.reset(new PepperView(this, &context_, client_->GetFrameProducer())); | 623 view_->Initialize(client_->GetFrameProducer()); |
618 view_weak_factory_.reset( | 624 |
619 new base::WeakPtrFactory<FrameConsumer>(view_.get())); | |
620 consumer_proxy->Attach(view_weak_factory_->GetWeakPtr()); | |
621 if (!plugin_view_.is_null()) { | 625 if (!plugin_view_.is_null()) { |
622 view_->SetView(plugin_view_); | 626 view_->SetView(plugin_view_); |
623 } | 627 } |
624 | 628 |
625 // Connect the input pipeline to the protocol stub & initialize components. | 629 // Connect the input pipeline to the protocol stub & initialize components. |
626 mouse_input_filter_.set_input_stub(host_connection_->input_stub()); | 630 mouse_input_filter_.set_input_stub(host_connection_->input_stub()); |
627 mouse_input_filter_.set_input_size(view_->get_view_size_dips()); | 631 mouse_input_filter_.set_input_size(view_->get_view_size_dips()); |
628 | 632 |
629 LOG(INFO) << "Connecting to " << config.host_jid | 633 LOG(INFO) << "Connecting to " << config.host_jid |
630 << ". Local jid: " << local_jid << "."; | 634 << ". Local jid: " << local_jid << "."; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 url_components.scheme.len); | 1047 url_components.scheme.len); |
1044 return url_scheme == kChromeExtensionUrlScheme; | 1048 return url_scheme == kChromeExtensionUrlScheme; |
1045 } | 1049 } |
1046 | 1050 |
1047 bool ChromotingInstance::IsConnected() { | 1051 bool ChromotingInstance::IsConnected() { |
1048 return host_connection_.get() && | 1052 return host_connection_.get() && |
1049 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 1053 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
1050 } | 1054 } |
1051 | 1055 |
1052 } // namespace remoting | 1056 } // namespace remoting |
OLD | NEW |