OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // TODO(ajwong): We need to come up with a better description of the |
| 6 // responsibilities for each thread. |
| 7 |
| 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
| 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
| 10 |
| 11 #include <string> |
| 12 |
| 13 #include "base/at_exit.h" |
| 14 #include "base/scoped_ptr.h" |
| 15 #include "remoting/client/client_context.h" |
| 16 #include "remoting/client/host_connection.h" |
| 17 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 18 #include "third_party/ppapi/c/pp_event.h" |
| 19 #include "third_party/ppapi/c/pp_instance.h" |
| 20 #include "third_party/ppapi/c/pp_rect.h" |
| 21 #include "third_party/ppapi/c/pp_resource.h" |
| 22 #include "third_party/ppapi/cpp/instance.h" |
| 23 #include "third_party/ppapi/cpp/device_context_2d.h" |
| 24 #include "third_party/ppapi/cpp/var.h" |
| 25 |
| 26 class MessageLoop; |
| 27 |
| 28 namespace base { |
| 29 class Thread; |
| 30 } // namespace base |
| 31 |
| 32 namespace pp { |
| 33 class Module; |
| 34 } // namespace pp |
| 35 |
| 36 namespace remoting { |
| 37 |
| 38 class ChromotingClient; |
| 39 class ClientContext; |
| 40 class HostConnection; |
| 41 class InputHandler; |
| 42 class JingleThread; |
| 43 class PepperView; |
| 44 |
| 45 class ChromotingInstance : public pp::Instance { |
| 46 public: |
| 47 // The mimetype for which this plugin is registered. |
| 48 static const char *kMimeType; |
| 49 |
| 50 explicit ChromotingInstance(PP_Instance instance); |
| 51 virtual ~ChromotingInstance(); |
| 52 |
| 53 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
| 54 virtual void Connect(const ClientConfig& config); |
| 55 virtual bool HandleEvent(const PP_Event& event); |
| 56 virtual pp::Var GetInstanceObject(); |
| 57 virtual void ViewChanged(const pp::Rect& position, const pp::Rect& clip); |
| 58 |
| 59 virtual bool CurrentlyOnPluginThread() const; |
| 60 |
| 61 private: |
| 62 FRIEND_TEST(ChromotingInstanceTest, TestCaseSetup); |
| 63 |
| 64 // Since we're an internal plugin, we can just grab the message loop during |
| 65 // init to figure out which thread we're on. This should only be used to |
| 66 // sanity check which thread we're executing on. Do not post task here! |
| 67 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. |
| 68 // |
| 69 // TODO(ajwong): Think if there is a better way to safeguard this. |
| 70 MessageLoop* pepper_main_loop_dont_post_to_me_; |
| 71 |
| 72 ClientContext context_; |
| 73 scoped_ptr<HostConnection> host_connection_; |
| 74 scoped_ptr<PepperView> view_; |
| 75 scoped_ptr<InputHandler> input_handler_; |
| 76 scoped_ptr<ChromotingClient> client_; |
| 77 pp::Var instance_object_; // JavaScript interface to control this instance. |
| 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
| 80 }; |
| 81 |
| 82 } // namespace remoting |
| 83 |
| 84 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |