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 // This class responds to requests from renderers for the list of plugins, and | 5 // This class responds to requests from renderers for the list of plugins, and |
6 // also a proxy object for plugin instances. | 6 // also a proxy object for plugin instances. |
7 | 7 |
8 #ifndef CHROME_BROWSER_PLUGIN_SERVICE_H__ | 8 #ifndef CHROME_BROWSER_PLUGIN_SERVICE_H_ |
9 #define CHROME_BROWSER_PLUGIN_SERVICE_H__ | 9 #define CHROME_BROWSER_PLUGIN_SERVICE_H_ |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
15 #include "base/lock.h" | 15 #include "base/lock.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "webkit/glue/webplugin.h" | 17 #include "webkit/glue/webplugin.h" |
18 | 18 |
19 namespace IPC { | 19 namespace IPC { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 FilePath chrome_plugin_data_dir_; | 134 FilePath chrome_plugin_data_dir_; |
135 | 135 |
136 // The browser's UI locale. | 136 // The browser's UI locale. |
137 const std::wstring ui_locale_; | 137 const std::wstring ui_locale_; |
138 | 138 |
139 // Need synchronization whenever we access the plugin_list singelton through | 139 // Need synchronization whenever we access the plugin_list singelton through |
140 // webkit_glue since this class is called on the main and IO thread. | 140 // webkit_glue since this class is called on the main and IO thread. |
141 Lock lock_; | 141 Lock lock_; |
142 | 142 |
143 // Handles plugin process shutdown. | 143 // Handles plugin process shutdown. |
144 class ShutdownHandler : | 144 class ShutdownHandler : public base::RefCountedThreadSafe<ShutdownHandler> { |
145 public base::RefCountedThreadSafe<ShutdownHandler> { | |
146 public: | 145 public: |
147 ShutdownHandler() {} | 146 ShutdownHandler() {} |
148 ~ShutdownHandler() {} | 147 ~ShutdownHandler() {} |
149 | 148 |
150 // Initiates plugin process shutdown. Ensures that the actual shutdown | 149 // Initiates plugin process shutdown. Ensures that the actual shutdown |
151 // happens on the io thread. | 150 // happens on the io thread. |
152 void InitiateShutdown(); | 151 void InitiateShutdown(); |
153 | 152 |
154 private: | 153 private: |
155 // Shutdown handler which runs on the io thread. | 154 // Shutdown handler which runs on the io thread. |
156 void OnShutdown(); | 155 void OnShutdown(); |
157 | 156 |
158 DISALLOW_EVIL_CONSTRUCTORS(ShutdownHandler); | 157 DISALLOW_COPY_AND_ASSIGN(ShutdownHandler); |
159 }; | 158 }; |
160 | 159 |
161 friend class ShutdownHandler; | 160 friend class ShutdownHandler; |
162 scoped_refptr<ShutdownHandler> plugin_shutdown_handler_; | 161 scoped_refptr<ShutdownHandler> plugin_shutdown_handler_; |
163 | 162 |
164 DISALLOW_EVIL_CONSTRUCTORS(PluginService); | 163 DISALLOW_COPY_AND_ASSIGN(PluginService); |
165 }; | 164 }; |
166 | 165 |
167 // The PluginProcessHostIterator allows to iterate through all the | 166 // The PluginProcessHostIterator allows to iterate through all the |
168 // PluginProcessHosts. Note that this should be done from the IO thread and that | 167 // PluginProcessHosts. Note that this should be done from the IO thread and that |
169 // the iterator should not be kept around as it may be invalidated on | 168 // the iterator should not be kept around as it may be invalidated on |
170 // subsequent event processing in the event loop. | 169 // subsequent event processing in the event loop. |
171 class PluginProcessHostIterator { | 170 class PluginProcessHostIterator { |
172 public: | 171 public: |
173 PluginProcessHostIterator(); | 172 PluginProcessHostIterator(); |
174 PluginProcessHostIterator(const PluginProcessHostIterator& instance); | 173 PluginProcessHostIterator(const PluginProcessHostIterator& instance); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 206 |
208 bool Done() { | 207 bool Done() { |
209 return (iterator_ == end_); | 208 return (iterator_ == end_); |
210 } | 209 } |
211 | 210 |
212 private: | 211 private: |
213 PluginService::PluginMap::const_iterator iterator_; | 212 PluginService::PluginMap::const_iterator iterator_; |
214 PluginService::PluginMap::const_iterator end_; | 213 PluginService::PluginMap::const_iterator end_; |
215 }; | 214 }; |
216 | 215 |
217 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H__ | 216 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |