OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/common/notification_registrar.h" | 26 #include "content/common/notification_registrar.h" |
27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
28 #include "ipc/ipc_channel_handle.h" | 28 #include "ipc/ipc_channel_handle.h" |
29 #include "webkit/plugins/npapi/webplugininfo.h" | 29 #include "webkit/plugins/npapi/webplugininfo.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "base/memory/scoped_ptr.h" | 32 #include "base/memory/scoped_ptr.h" |
33 #include "base/win/registry.h" | 33 #include "base/win/registry.h" |
34 #endif | 34 #endif |
35 | 35 |
36 #if defined(OS_LINUX) | 36 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
37 #include "base/files/file_path_watcher.h" | 37 #include "base/files/file_path_watcher.h" |
38 #endif | 38 #endif |
39 | 39 |
40 struct PepperPluginInfo; | 40 struct PepperPluginInfo; |
41 class PluginDirWatcherDelegate; | 41 class PluginDirWatcherDelegate; |
42 | 42 |
43 // This must be created on the main thread but it's only called on the IO/file | 43 // This must be created on the main thread but it's only called on the IO/file |
44 // thread. | 44 // thread. |
45 class PluginService | 45 class PluginService |
46 : public base::WaitableEventWatcher::Delegate, | 46 : public base::WaitableEventWatcher::Delegate, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const GURL& url, | 144 const GURL& url, |
145 const std::string& mime_type, | 145 const std::string& mime_type, |
146 PluginProcessHost::Client* client); | 146 PluginProcessHost::Client* client); |
147 | 147 |
148 // Helper so we can finish opening the channel after looking up the | 148 // Helper so we can finish opening the channel after looking up the |
149 // plugin. | 149 // plugin. |
150 void FinishOpenChannelToPlugin( | 150 void FinishOpenChannelToPlugin( |
151 const FilePath& plugin_path, | 151 const FilePath& plugin_path, |
152 PluginProcessHost::Client* client); | 152 PluginProcessHost::Client* client); |
153 | 153 |
154 #if defined(OS_LINUX) | 154 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
155 // Registers a new FilePathWatcher for a given path. | 155 // Registers a new FilePathWatcher for a given path. |
156 static void RegisterFilePathWatcher( | 156 static void RegisterFilePathWatcher( |
157 base::files::FilePathWatcher* watcher, | 157 base::files::FilePathWatcher* watcher, |
158 const FilePath& path, | 158 const FilePath& path, |
159 base::files::FilePathWatcher::Delegate* delegate); | 159 base::files::FilePathWatcher::Delegate* delegate); |
160 #endif | 160 #endif |
161 | 161 |
162 // The browser's UI locale. | 162 // The browser's UI locale. |
163 const std::string ui_locale_; | 163 const std::string ui_locale_; |
164 | 164 |
165 // Map of plugin paths to the origin they are restricted to. | 165 // Map of plugin paths to the origin they are restricted to. |
166 base::Lock restricted_plugin_lock_; // Guards access to restricted_plugin_. | 166 base::Lock restricted_plugin_lock_; // Guards access to restricted_plugin_. |
167 typedef base::hash_map<FilePath, GURL> RestrictedPluginMap; | 167 typedef base::hash_map<FilePath, GURL> RestrictedPluginMap; |
168 RestrictedPluginMap restricted_plugin_; | 168 RestrictedPluginMap restricted_plugin_; |
169 | 169 |
170 NotificationRegistrar registrar_; | 170 NotificationRegistrar registrar_; |
171 | 171 |
172 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
173 // Registry keys for getting notifications when new plugins are installed. | 173 // Registry keys for getting notifications when new plugins are installed. |
174 base::win::RegKey hkcu_key_; | 174 base::win::RegKey hkcu_key_; |
175 base::win::RegKey hklm_key_; | 175 base::win::RegKey hklm_key_; |
176 scoped_ptr<base::WaitableEvent> hkcu_event_; | 176 scoped_ptr<base::WaitableEvent> hkcu_event_; |
177 scoped_ptr<base::WaitableEvent> hklm_event_; | 177 scoped_ptr<base::WaitableEvent> hklm_event_; |
178 base::WaitableEventWatcher hkcu_watcher_; | 178 base::WaitableEventWatcher hkcu_watcher_; |
179 base::WaitableEventWatcher hklm_watcher_; | 179 base::WaitableEventWatcher hklm_watcher_; |
180 #endif | 180 #endif |
181 | 181 |
182 #if defined(OS_LINUX) | 182 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
183 ScopedVector<base::files::FilePathWatcher> file_watchers_; | 183 ScopedVector<base::files::FilePathWatcher> file_watchers_; |
184 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; | 184 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; |
185 #endif | 185 #endif |
186 | 186 |
187 std::vector<PepperPluginInfo> ppapi_plugins_; | 187 std::vector<PepperPluginInfo> ppapi_plugins_; |
188 | 188 |
189 std::vector<OverriddenPlugin> overridden_plugins_; | 189 std::vector<OverriddenPlugin> overridden_plugins_; |
190 base::Lock overridden_plugins_lock_; | 190 base::Lock overridden_plugins_lock_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(PluginService); | 192 DISALLOW_COPY_AND_ASSIGN(PluginService); |
193 }; | 193 }; |
194 | 194 |
195 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 195 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
196 | 196 |
197 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 197 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |