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