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 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 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/hash_tables.h" | 16 #include "base/hash_tables.h" |
| 17 #include "base/scoped_vector.h" |
17 #include "base/singleton.h" | 18 #include "base/singleton.h" |
18 #include "base/synchronization/waitable_event_watcher.h" | 19 #include "base/synchronization/waitable_event_watcher.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "chrome/browser/plugin_process_host.h" | 21 #include "chrome/browser/plugin_process_host.h" |
21 #include "chrome/common/notification_observer.h" | 22 #include "chrome/common/notification_observer.h" |
22 #include "chrome/common/notification_registrar.h" | 23 #include "chrome/common/notification_registrar.h" |
23 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
24 #include "ipc/ipc_channel_handle.h" | 25 #include "ipc/ipc_channel_handle.h" |
25 | 26 |
26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
27 #include "base/scoped_ptr.h" | 28 #include "base/scoped_ptr.h" |
28 #include "base/win/registry.h" | 29 #include "base/win/registry.h" |
29 #endif | 30 #endif |
30 | 31 |
| 32 #if defined(OS_LINUX) |
| 33 #include "chrome/browser/file_path_watcher/file_path_watcher.h" |
| 34 #endif |
| 35 |
31 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
32 namespace chromeos { | 37 namespace chromeos { |
33 class PluginSelectionPolicy; | 38 class PluginSelectionPolicy; |
34 } | 39 } |
35 #endif | 40 #endif |
36 | 41 |
37 namespace IPC { | 42 namespace IPC { |
38 class Message; | 43 class Message; |
39 } | 44 } |
40 | 45 |
41 class MessageLoop; | 46 class MessageLoop; |
42 class Profile; | 47 class Profile; |
| 48 class PluginDirWatcherDelegate; |
43 class ResourceDispatcherHost; | 49 class ResourceDispatcherHost; |
44 | 50 |
45 namespace net { | 51 namespace net { |
46 class URLRequestContext; | 52 class URLRequestContext; |
47 } // namespace net | 53 } // namespace net |
48 | 54 |
49 namespace webkit { | 55 namespace webkit { |
50 namespace npapi { | 56 namespace npapi { |
51 struct WebPluginInfo; | 57 struct WebPluginInfo; |
52 } | 58 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const GURL& url, | 143 const GURL& url, |
138 const std::string& mime_type, | 144 const std::string& mime_type, |
139 PluginProcessHost::Client* client); | 145 PluginProcessHost::Client* client); |
140 | 146 |
141 // Helper so we can finish opening the channel after looking up the | 147 // Helper so we can finish opening the channel after looking up the |
142 // plugin. | 148 // plugin. |
143 void FinishOpenChannelToPlugin( | 149 void FinishOpenChannelToPlugin( |
144 const FilePath& plugin_path, | 150 const FilePath& plugin_path, |
145 PluginProcessHost::Client* client); | 151 PluginProcessHost::Client* client); |
146 | 152 |
| 153 #if defined(OS_LINUX) |
| 154 // Registers a new FilePathWatcher for a given path. |
| 155 static void RegisterFilePathWatcher( |
| 156 FilePathWatcher* watcher, |
| 157 const FilePath& path, |
| 158 FilePathWatcher::Delegate* delegate); |
| 159 #endif |
| 160 |
147 // mapping between plugin path and PluginProcessHost | 161 // mapping between plugin path and PluginProcessHost |
148 typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap; | 162 typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap; |
149 PluginMap plugin_hosts_; | 163 PluginMap plugin_hosts_; |
150 | 164 |
151 // The main thread's message loop. | 165 // The main thread's message loop. |
152 MessageLoop* main_message_loop_; | 166 MessageLoop* main_message_loop_; |
153 | 167 |
154 // The IO thread's resource dispatcher host. | 168 // The IO thread's resource dispatcher host. |
155 ResourceDispatcherHost* resource_dispatcher_host_; | 169 ResourceDispatcherHost* resource_dispatcher_host_; |
156 | 170 |
(...skipping 17 matching lines...) Expand all Loading... |
174 #if defined(OS_WIN) | 188 #if defined(OS_WIN) |
175 // Registry keys for getting notifications when new plugins are installed. | 189 // Registry keys for getting notifications when new plugins are installed. |
176 base::win::RegKey hkcu_key_; | 190 base::win::RegKey hkcu_key_; |
177 base::win::RegKey hklm_key_; | 191 base::win::RegKey hklm_key_; |
178 scoped_ptr<base::WaitableEvent> hkcu_event_; | 192 scoped_ptr<base::WaitableEvent> hkcu_event_; |
179 scoped_ptr<base::WaitableEvent> hklm_event_; | 193 scoped_ptr<base::WaitableEvent> hklm_event_; |
180 base::WaitableEventWatcher hkcu_watcher_; | 194 base::WaitableEventWatcher hkcu_watcher_; |
181 base::WaitableEventWatcher hklm_watcher_; | 195 base::WaitableEventWatcher hklm_watcher_; |
182 #endif | 196 #endif |
183 | 197 |
| 198 #if defined(OS_LINUX) |
| 199 ScopedVector<FilePathWatcher> file_watchers_; |
| 200 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; |
| 201 #endif |
| 202 |
184 // Set to true if chrome plugins are enabled. Defaults to true. | 203 // Set to true if chrome plugins are enabled. Defaults to true. |
185 static bool enable_chrome_plugins_; | 204 static bool enable_chrome_plugins_; |
186 | 205 |
187 DISALLOW_COPY_AND_ASSIGN(PluginService); | 206 DISALLOW_COPY_AND_ASSIGN(PluginService); |
188 }; | 207 }; |
189 | 208 |
190 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 209 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
191 | 210 |
192 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ | 211 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |