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