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 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "remoting/client/host_connection.h" | 12 #include "remoting/client/host_connection.h" |
13 #include "testing/gtest/include/gtest/gtest_prod.h" | 13 #include "testing/gtest/include/gtest/gtest_prod.h" |
14 #include "third_party/ppapi/cpp/device_context_2d.h" | 14 #include "third_party/ppapi/c/pp_event.h" |
15 #include "third_party/ppapi/cpp/instance.h" | 15 #include "third_party/ppapi/c/pp_instance.h" |
| 16 #include "third_party/ppapi/c/pp_rect.h" |
| 17 #include "third_party/ppapi/c/pp_resource.h" |
| 18 #include "third_party/ppapi/c/ppb_instance.h" |
16 | 19 |
17 namespace base { | 20 namespace base { |
18 class Thread; | 21 class Thread; |
19 } // namespace base | 22 } // namespace base |
20 | 23 |
21 namespace remoting { | 24 namespace remoting { |
22 | 25 |
23 class ChromotingClient; | 26 class ChromotingClient; |
24 class HostConnection; | 27 class HostConnection; |
25 class JingleThread; | 28 class JingleThread; |
26 class PepperView; | 29 class PepperView; |
27 | 30 |
28 class ChromotingClient; | 31 class ChromotingClient; |
29 | 32 |
30 class ChromotingPlugin : public pp::Instance { | 33 class ChromotingPlugin { |
31 public: | 34 public: |
32 // The mimetype for which this plugin is registered. | 35 // The mimetype for which this plugin is registered. |
33 // | 36 // |
34 // TODO(ajwong): Mimetype doesn't really make sense for us as the trigger | 37 // TODO(ajwong): Mimetype doesn't really make sense for us as the trigger |
35 // point. I think we should handle a special protocol (eg., chromotocol://) | 38 // point. I think we should handle a special protocol (eg., chromotocol://) |
36 static const char *kMimeType; | 39 static const char *kMimeType; |
37 | 40 |
38 ChromotingPlugin(PP_Instance instance); | 41 ChromotingPlugin(PP_Instance instance, const PPB_Instance* instance_funcs); |
39 virtual ~ChromotingPlugin(); | 42 virtual ~ChromotingPlugin(); |
40 | 43 |
41 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | 44 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
42 virtual bool HandleEvent(const PP_Event& event); | 45 virtual bool HandleEvent(const PP_Event& event); |
43 virtual void ViewChanged(const PP_Rect& position, const PP_Rect& clip); | 46 virtual void ViewChanged(const PP_Rect& position, const PP_Rect& clip); |
44 | 47 |
45 private: | 48 private: |
46 FRIEND_TEST(ChromotingPluginTest, ParseUrl); | 49 FRIEND_TEST(ChromotingPluginTest, ParseUrl); |
47 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup); | 50 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup); |
48 | 51 |
49 static bool ParseUrl(const std::string& url, | 52 static bool ParseUrl(const std::string& url, |
50 std::string* user_id, | 53 std::string* user_id, |
51 std::string* auth_token, | 54 std::string* auth_token, |
52 std::string* host_jid); | 55 std::string* host_jid); |
53 | 56 |
54 // Size of the plugin window. | 57 // Size of the plugin window. |
55 int width_; | 58 int width_; |
56 int height_; | 59 int height_; |
57 | 60 |
58 pp::DeviceContext2D device_context_; | 61 PP_Resource drawing_context_; |
| 62 |
| 63 PP_Instance pp_instance_; |
| 64 const PPB_Instance* ppb_instance_funcs_; |
59 | 65 |
60 scoped_ptr<base::Thread> main_thread_; | 66 scoped_ptr<base::Thread> main_thread_; |
61 scoped_ptr<JingleThread> network_thread_; | 67 scoped_ptr<JingleThread> network_thread_; |
62 | 68 |
63 scoped_ptr<HostConnection> host_connection_; | 69 scoped_ptr<HostConnection> host_connection_; |
64 scoped_ptr<PepperView> view_; | 70 scoped_ptr<PepperView> view_; |
65 scoped_ptr<ChromotingClient> client_; | 71 scoped_ptr<ChromotingClient> client_; |
66 | 72 |
67 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin); | 73 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin); |
68 }; | 74 }; |
69 | 75 |
70 } // namespace remoting | 76 } // namespace remoting |
71 | 77 |
72 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 78 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
OLD | NEW |