| 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 "base/native_library.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/common/child_thread.h" | 11 #include "chrome/common/child_thread.h" |
| 12 #include "chrome/plugin/plugin_channel.h" | 12 #include "chrome/plugin/plugin_channel.h" |
| 13 #include "webkit/glue/plugins/plugin_lib.h" | 13 #include "webkit/glue/plugins/plugin_lib.h" |
| 14 | 14 |
| 15 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
| 16 #include "base/file_descriptor_posix.h" | 16 #include "base/file_descriptor_posix.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 class NotificationService; | |
| 20 | |
| 21 // The PluginThread class represents a background thread where plugin instances | 19 // The PluginThread class represents a background thread where plugin instances |
| 22 // live. Communication occurs between WebPluginDelegateProxy in the renderer | 20 // live. Communication occurs between WebPluginDelegateProxy in the renderer |
| 23 // process and WebPluginDelegateStub in this thread through IPC messages. | 21 // process and WebPluginDelegateStub in this thread through IPC messages. |
| 24 class PluginThread : public ChildThread { | 22 class PluginThread : public ChildThread { |
| 25 public: | 23 public: |
| 26 PluginThread(); | 24 PluginThread(); |
| 27 ~PluginThread(); | 25 ~PluginThread(); |
| 28 | 26 |
| 29 // Returns the one plugin thread. | 27 // Returns the one plugin thread. |
| 30 static PluginThread* current(); | 28 static PluginThread* current(); |
| 31 | 29 |
| 32 private: | 30 private: |
| 33 virtual void OnControlMessageReceived(const IPC::Message& msg); | 31 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 34 | 32 |
| 35 // Thread implementation: | |
| 36 virtual void Init(); | |
| 37 virtual void CleanUp(); | |
| 38 | |
| 39 // Callback for when a channel has been created. | 33 // Callback for when a channel has been created. |
| 40 void OnCreateChannel( | 34 void OnCreateChannel( |
| 41 int process_id, | 35 int process_id, |
| 42 bool off_the_record); | 36 bool off_the_record); |
| 43 void OnPluginMessage(const std::vector<uint8> &data); | 37 void OnPluginMessage(const std::vector<uint8> &data); |
| 44 | 38 |
| 45 scoped_ptr<NotificationService> notification_service_; | |
| 46 | |
| 47 // The plugin module which is preloaded in Init | 39 // The plugin module which is preloaded in Init |
| 48 base::NativeLibrary preloaded_plugin_module_; | 40 base::NativeLibrary preloaded_plugin_module_; |
| 49 | 41 |
| 50 // Points to the plugin file that this process hosts. | 42 // Points to the plugin file that this process hosts. |
| 51 FilePath plugin_path_; | 43 FilePath plugin_path_; |
| 52 | 44 |
| 53 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); | 45 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); |
| 54 }; | 46 }; |
| 55 | 47 |
| 56 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ | 48 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ |
| OLD | NEW |