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