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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 webkit::npapi::WebPluginInfo plugin; | 69 webkit::npapi::WebPluginInfo plugin; |
70 }; | 70 }; |
71 | 71 |
72 // Initializes the global instance; should be called on startup from the main | 72 // Initializes the global instance; should be called on startup from the main |
73 // thread. | 73 // thread. |
74 static void InitGlobalInstance(Profile* profile); | 74 static void InitGlobalInstance(Profile* profile); |
75 | 75 |
76 // Returns the PluginService singleton. | 76 // Returns the PluginService singleton. |
77 static PluginService* GetInstance(); | 77 static PluginService* GetInstance(); |
78 | 78 |
79 // Load all the plugins that should be loaded for the lifetime of the browser | |
80 // (ie, with the LoadOnStartup flag set). | |
81 void LoadChromePlugins(ResourceDispatcherHost* resource_dispatcher_host); | |
82 | |
83 // Sets/gets the data directory that Chrome plugins should use to store | |
84 // persistent data. | |
85 void SetChromePluginDataDir(const FilePath& data_dir); | |
86 const FilePath& GetChromePluginDataDir(); | |
87 | |
88 // Gets the browser's UI locale. | 79 // Gets the browser's UI locale. |
89 const std::string& GetUILocale(); | 80 const std::string& GetUILocale(); |
90 | 81 |
91 // Returns the plugin process host corresponding to the plugin process that | 82 // Returns the plugin process host corresponding to the plugin process that |
92 // has been started by this service. Returns NULL if no process has been | 83 // has been started by this service. Returns NULL if no process has been |
93 // started. | 84 // started. |
94 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); | 85 PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path); |
95 PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path); | 86 PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path); |
96 | 87 |
97 // Returns the plugin process host corresponding to the plugin process that | 88 // Returns the plugin process host corresponding to the plugin process that |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Safe to be called from any thread. | 121 // Safe to be called from any thread. |
131 void OverridePluginForTab(OverriddenPlugin plugin); | 122 void OverridePluginForTab(OverriddenPlugin plugin); |
132 | 123 |
133 // The UI thread's message loop | 124 // The UI thread's message loop |
134 MessageLoop* main_message_loop() { return main_message_loop_; } | 125 MessageLoop* main_message_loop() { return main_message_loop_; } |
135 | 126 |
136 ResourceDispatcherHost* resource_dispatcher_host() const { | 127 ResourceDispatcherHost* resource_dispatcher_host() const { |
137 return resource_dispatcher_host_; | 128 return resource_dispatcher_host_; |
138 } | 129 } |
139 | 130 |
140 static void EnableChromePlugins(bool enable); | |
141 | |
142 private: | 131 private: |
143 friend struct DefaultSingletonTraits<PluginService>; | 132 friend struct DefaultSingletonTraits<PluginService>; |
144 | 133 |
145 // Creates the PluginService object, but doesn't actually build the plugin | 134 // Creates the PluginService object, but doesn't actually build the plugin |
146 // list yet. It's generated lazily. | 135 // list yet. It's generated lazily. |
147 PluginService(); | 136 PluginService(); |
148 ~PluginService(); | 137 ~PluginService(); |
149 | 138 |
150 // base::WaitableEventWatcher::Delegate implementation. | 139 // base::WaitableEventWatcher::Delegate implementation. |
151 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 140 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
(...skipping 25 matching lines...) Expand all Loading... |
177 const FilePath& path, | 166 const FilePath& path, |
178 FilePathWatcher::Delegate* delegate); | 167 FilePathWatcher::Delegate* delegate); |
179 #endif | 168 #endif |
180 | 169 |
181 // The main thread's message loop. | 170 // The main thread's message loop. |
182 MessageLoop* main_message_loop_; | 171 MessageLoop* main_message_loop_; |
183 | 172 |
184 // The IO thread's resource dispatcher host. | 173 // The IO thread's resource dispatcher host. |
185 ResourceDispatcherHost* resource_dispatcher_host_; | 174 ResourceDispatcherHost* resource_dispatcher_host_; |
186 | 175 |
187 // The data directory that Chrome plugins should use to store persistent data. | |
188 FilePath chrome_plugin_data_dir_; | |
189 | |
190 // The browser's UI locale. | 176 // The browser's UI locale. |
191 const std::string ui_locale_; | 177 const std::string ui_locale_; |
192 | 178 |
193 // Map of plugin paths to the origin they are restricted to. Used for | 179 // Map of plugin paths to the origin they are restricted to. Used for |
194 // extension-only plugins. | 180 // extension-only plugins. |
195 typedef base::hash_map<FilePath, GURL> PrivatePluginMap; | 181 typedef base::hash_map<FilePath, GURL> PrivatePluginMap; |
196 PrivatePluginMap private_plugins_; | 182 PrivatePluginMap private_plugins_; |
197 | 183 |
198 NotificationRegistrar registrar_; | 184 NotificationRegistrar registrar_; |
199 | 185 |
(...skipping 11 matching lines...) Expand all Loading... |
211 base::WaitableEventWatcher hklm_watcher_; | 197 base::WaitableEventWatcher hklm_watcher_; |
212 #endif | 198 #endif |
213 | 199 |
214 #if defined(OS_LINUX) | 200 #if defined(OS_LINUX) |
215 ScopedVector<FilePathWatcher> file_watchers_; | 201 ScopedVector<FilePathWatcher> file_watchers_; |
216 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; | 202 scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_; |
217 #endif | 203 #endif |
218 | 204 |
219 std::vector<PepperPluginInfo> ppapi_plugins_; | 205 std::vector<PepperPluginInfo> ppapi_plugins_; |
220 | 206 |
221 // Set to true if chrome plugins are enabled. Defaults to true. | |
222 static bool enable_chrome_plugins_; | |
223 | |
224 std::vector<OverriddenPlugin> overridden_plugins_; | 207 std::vector<OverriddenPlugin> overridden_plugins_; |
225 base::Lock overridden_plugins_lock_; | 208 base::Lock overridden_plugins_lock_; |
226 | 209 |
227 DISALLOW_COPY_AND_ASSIGN(PluginService); | 210 DISALLOW_COPY_AND_ASSIGN(PluginService); |
228 }; | 211 }; |
229 | 212 |
230 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 213 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
231 | 214 |
232 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 215 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |