| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_PLUGIN_PLUGIN_THREAD_H_ | 5 #ifndef CHROME_PLUGIN_PLUGIN_THREAD_H_ |
| 6 #define CHROME_PLUGIN_PLUGIN_THREAD_H_ | 6 #define CHROME_PLUGIN_PLUGIN_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/native_library.h" |
| 9 #include "chrome/common/child_thread.h" | 10 #include "chrome/common/child_thread.h" |
| 10 #include "chrome/plugin/plugin_channel.h" | 11 #include "chrome/plugin/plugin_channel.h" |
| 11 | 12 |
| 12 class NotificationService; | 13 class NotificationService; |
| 13 | 14 |
| 14 // The PluginThread class represents a background thread where plugin instances | 15 // The PluginThread class represents a background thread where plugin instances |
| 15 // live. Communication occurs between WebPluginDelegateProxy in the renderer | 16 // live. Communication occurs between WebPluginDelegateProxy in the renderer |
| 16 // process and WebPluginDelegateStub in this thread through IPC messages. | 17 // process and WebPluginDelegateStub in this thread through IPC messages. |
| 17 class PluginThread : public ChildThread { | 18 class PluginThread : public ChildThread { |
| 18 public: | 19 public: |
| 19 PluginThread(); | 20 PluginThread(); |
| 20 ~PluginThread(); | 21 ~PluginThread(); |
| 21 | 22 |
| 22 // Returns the one plugin thread. | 23 // Returns the one plugin thread. |
| 23 static PluginThread* current(); | 24 static PluginThread* current(); |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 virtual void OnControlMessageReceived(const IPC::Message& msg); | 27 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 27 | 28 |
| 28 // Thread implementation: | 29 // Thread implementation: |
| 29 virtual void Init(); | 30 virtual void Init(); |
| 30 virtual void CleanUp(); | 31 virtual void CleanUp(); |
| 31 | 32 |
| 32 void OnCreateChannel(bool off_the_record); | 33 void OnCreateChannel(bool off_the_record); |
| 33 void OnPluginMessage(const std::vector<uint8> &data); | 34 void OnPluginMessage(const std::vector<uint8> &data); |
| 34 | 35 |
| 35 scoped_ptr<NotificationService> notification_service_; | 36 scoped_ptr<NotificationService> notification_service_; |
| 36 | 37 |
| 37 // The plugin module which is preloaded in Init | 38 // The plugin module which is preloaded in Init |
| 38 HMODULE preloaded_plugin_module_; | 39 base::NativeLibrary preloaded_plugin_module_; |
| 39 | 40 |
| 40 // Points to the plugin file that this process hosts. | 41 // Points to the plugin file that this process hosts. |
| 41 FilePath plugin_path_; | 42 FilePath plugin_path_; |
| 42 | 43 |
| 43 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); | 44 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ | 47 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ |
| OLD | NEW |