| 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 // TODO(ajwong): We need to come up with a better description of the | 5 // TODO(ajwong): We need to come up with a better description of the |
| 6 // responsibilities for each thread. | 6 // responsibilities for each thread. |
| 7 | 7 |
| 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
| 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class Thread; | 27 class Thread; |
| 28 } // namespace base | 28 } // namespace base |
| 29 | 29 |
| 30 namespace pp { | 30 namespace pp { |
| 31 class Module; | 31 class Module; |
| 32 } // namespace pp | 32 } // namespace pp |
| 33 | 33 |
| 34 namespace remoting { | 34 namespace remoting { |
| 35 | 35 |
| 36 class ChromotingClient; | 36 class ChromotingClient; |
| 37 class ClientContext; |
| 37 class HostConnection; | 38 class HostConnection; |
| 39 class InputHandler; |
| 38 class JingleThread; | 40 class JingleThread; |
| 39 class PepperView; | 41 class PepperView; |
| 40 | 42 |
| 41 class ChromotingPlugin : public pp::Instance { | 43 class ChromotingPlugin : public pp::Instance { |
| 42 public: | 44 public: |
| 43 // The mimetype for which this plugin is registered. | 45 // The mimetype for which this plugin is registered. |
| 44 static const char *kMimeType; | 46 static const char *kMimeType; |
| 45 | 47 |
| 46 ChromotingPlugin(PP_Instance instance); | 48 ChromotingPlugin(PP_Instance instance); |
| 47 virtual ~ChromotingPlugin(); | 49 virtual ~ChromotingPlugin(); |
| 48 | 50 |
| 49 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | 51 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
| 50 virtual bool HandleEvent(const PP_Event& event); | 52 virtual bool HandleEvent(const PP_Event& event); |
| 51 virtual void ViewChanged(const PP_Rect& position, const PP_Rect& clip); | 53 virtual void ViewChanged(const PP_Rect& position, const PP_Rect& clip); |
| 52 | 54 |
| 53 virtual bool CurrentlyOnPluginThread() const; | 55 virtual bool CurrentlyOnPluginThread() const; |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 FRIEND_TEST(ChromotingPluginTest, ParseUrl); | 58 FRIEND_TEST(ChromotingPluginTest, ParseUrl); |
| 57 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup); | 59 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup); |
| 58 | 60 |
| 59 static bool ParseUrl(const std::string& url, | |
| 60 std::string* user_id, | |
| 61 std::string* auth_token, | |
| 62 std::string* host_jid); | |
| 63 | |
| 64 // Since we're an internal plugin, we can just grab the message loop during | 61 // 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 | 62 // 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! | 63 // sanity check which thread we're executing on. Do not post task here! |
| 67 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. | 64 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. |
| 68 // | 65 // |
| 69 // TODO(ajwong): Think if there is a better way to safeguard this. | 66 // TODO(ajwong): Think if there is a better way to safeguard this. |
| 70 MessageLoop* pepper_main_loop_dont_post_to_me_; | 67 MessageLoop* pepper_main_loop_dont_post_to_me_; |
| 71 | 68 |
| 72 scoped_ptr<base::Thread> main_thread_; | 69 scoped_ptr<ClientContext> context_; |
| 73 scoped_ptr<JingleThread> network_thread_; | |
| 74 | 70 |
| 75 scoped_ptr<HostConnection> host_connection_; | 71 scoped_ptr<HostConnection> host_connection_; |
| 72 |
| 76 scoped_ptr<PepperView> view_; | 73 scoped_ptr<PepperView> view_; |
| 74 |
| 75 scoped_ptr<InputHandler> input_handler_; |
| 76 |
| 77 scoped_ptr<ChromotingClient> client_; | 77 scoped_ptr<ChromotingClient> client_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin); | 79 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace remoting | 82 } // namespace remoting |
| 83 | 83 |
| 84 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ | 84 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ |
| OLD | NEW |