| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/thread.h" | 12 #include "base/thread.h" |
| 13 #include "remoting/client/client_config.h" | 13 #include "remoting/client/client_config.h" |
| 14 #include "remoting/client/client_util.h" | 14 #include "remoting/client/client_util.h" |
| 15 #include "remoting/client/chromoting_client.h" | 15 #include "remoting/client/chromoting_client.h" |
| 16 #include "remoting/client/host_connection.h" | 16 #include "remoting/client/host_connection.h" |
| 17 #include "remoting/client/jingle_host_connection.h" | 17 #include "remoting/client/jingle_host_connection.h" |
| 18 #include "remoting/client/rectangle_update_decoder.h" |
| 18 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 19 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
| 19 #include "remoting/client/plugin/pepper_input_handler.h" | 20 #include "remoting/client/plugin/pepper_input_handler.h" |
| 20 #include "remoting/client/plugin/pepper_view.h" | 21 #include "remoting/client/plugin/pepper_view.h" |
| 21 #include "remoting/jingle_glue/jingle_thread.h" | 22 #include "remoting/jingle_glue/jingle_thread.h" |
| 22 #include "third_party/ppapi/c/pp_input_event.h" | 23 #include "third_party/ppapi/c/pp_input_event.h" |
| 23 #include "third_party/ppapi/cpp/completion_callback.h" | 24 #include "third_party/ppapi/cpp/completion_callback.h" |
| 24 #include "third_party/ppapi/cpp/rect.h" | 25 #include "third_party/ppapi/cpp/rect.h" |
| 25 | 26 |
| 26 namespace remoting { | 27 namespace remoting { |
| 27 | 28 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // TODO(ajwong): See if there is a method for querying what thread we're on | 61 // TODO(ajwong): See if there is a method for querying what thread we're on |
| 61 // from inside the pepper API. | 62 // from inside the pepper API. |
| 62 pepper_main_loop_dont_post_to_me_ = MessageLoop::current(); | 63 pepper_main_loop_dont_post_to_me_ = MessageLoop::current(); |
| 63 LOG(INFO) << "Started ChromotingInstance::Init"; | 64 LOG(INFO) << "Started ChromotingInstance::Init"; |
| 64 | 65 |
| 65 // Start all the threads. | 66 // Start all the threads. |
| 66 context_.Start(); | 67 context_.Start(); |
| 67 | 68 |
| 68 // Create the chromoting objects. | 69 // Create the chromoting objects. |
| 69 host_connection_.reset(new JingleHostConnection(&context_)); | 70 host_connection_.reset(new JingleHostConnection(&context_)); |
| 70 view_.reset(new PepperView(this)); | 71 view_.reset(new PepperView(this, &context_)); |
| 72 rectangle_decoder_.reset( |
| 73 new RectangleUpdateDecoder(context_.decode_message_loop(), view_.get())); |
| 71 input_handler_.reset(new PepperInputHandler(&context_, host_connection_.get(), | 74 input_handler_.reset(new PepperInputHandler(&context_, host_connection_.get(), |
| 72 view_.get())); | 75 view_.get())); |
| 73 | 76 |
| 74 // Default to a medium grey. | 77 // Default to a medium grey. |
| 75 view_->SetSolidFill(0xFFCDCDCD); | 78 view_->SetSolidFill(0xFFCDCDCD); |
| 76 | 79 |
| 77 return true; | 80 return true; |
| 78 } | 81 } |
| 79 | 82 |
| 80 void ChromotingInstance::Connect(const ClientConfig& config) { | 83 void ChromotingInstance::Connect(const ClientConfig& config) { |
| 81 DCHECK(CurrentlyOnPluginThread()); | 84 DCHECK(CurrentlyOnPluginThread()); |
| 82 | 85 |
| 83 client_.reset(new ChromotingClient(config, | 86 client_.reset(new ChromotingClient(config, |
| 84 &context_, | 87 &context_, |
| 85 host_connection_.get(), | 88 host_connection_.get(), |
| 86 view_.get(), | 89 view_.get(), |
| 90 rectangle_decoder_.get(), |
| 87 input_handler_.get(), | 91 input_handler_.get(), |
| 88 NULL)); | 92 NULL)); |
| 89 | 93 |
| 90 // Kick off the connection. | 94 // Kick off the connection. |
| 91 client_->Start(); | 95 client_->Start(); |
| 92 } | 96 } |
| 93 | 97 |
| 94 void ChromotingInstance::ViewChanged(const pp::Rect& position, | 98 void ChromotingInstance::ViewChanged(const pp::Rect& position, |
| 95 const pp::Rect& clip) { | 99 const pp::Rect& clip) { |
| 96 DCHECK(CurrentlyOnPluginThread()); | 100 DCHECK(CurrentlyOnPluginThread()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 162 |
| 159 LOG(ERROR) << "Object initted."; | 163 LOG(ERROR) << "Object initted."; |
| 160 // The pp::Var takes ownership of object here. | 164 // The pp::Var takes ownership of object here. |
| 161 instance_object_ = pp::Var(object); | 165 instance_object_ = pp::Var(object); |
| 162 } | 166 } |
| 163 | 167 |
| 164 return instance_object_; | 168 return instance_object_; |
| 165 } | 169 } |
| 166 | 170 |
| 167 } // namespace remoting | 171 } // namespace remoting |
| OLD | NEW |