OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class FilePath; | 19 class FilePath; |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class BrowserContext; | 24 class BrowserContext; |
25 class PluginProcessHost; | |
26 class PluginServiceFilter; | 25 class PluginServiceFilter; |
27 class ResourceContext; | 26 class ResourceContext; |
28 struct PepperPluginInfo; | 27 struct PepperPluginInfo; |
29 struct WebPluginInfo; | 28 struct WebPluginInfo; |
30 | 29 |
31 // This must be created on the main thread but it's only called on the IO/file | 30 // This must be created on the main thread but it's only called on the IO/file |
32 // thread. This is an asynchronous wrapper around the PluginList interface for | 31 // thread. This is an asynchronous wrapper around the PluginList interface for |
33 // querying plugin information. This must be used instead of that to avoid | 32 // querying plugin information. This must be used instead of that to avoid |
34 // doing expensive disk operations on the IO/UI threads. | 33 // doing expensive disk operations on the IO/UI threads. |
35 class PluginService { | 34 class PluginService { |
(...skipping 11 matching lines...) Expand all Loading... |
47 // NOTE: can only be called on the UI thread. | 46 // NOTE: can only be called on the UI thread. |
48 CONTENT_EXPORT static void PurgePluginListCache( | 47 CONTENT_EXPORT static void PurgePluginListCache( |
49 BrowserContext* browser_context, | 48 BrowserContext* browser_context, |
50 bool reload_pages); | 49 bool reload_pages); |
51 | 50 |
52 virtual ~PluginService() {} | 51 virtual ~PluginService() {} |
53 | 52 |
54 // Must be called on the instance to finish initialization. | 53 // Must be called on the instance to finish initialization. |
55 virtual void Init() = 0; | 54 virtual void Init() = 0; |
56 | 55 |
57 // Starts watching for changes in the list of installed plugins. | |
58 virtual void StartWatchingPlugins() = 0; | |
59 | |
60 // Gets the plugin in the list of plugins that matches the given url and mime | 56 // Gets the plugin in the list of plugins that matches the given url and mime |
61 // type. Returns true if the data is frome a stale plugin list, false if it | 57 // type. Returns true if the data is frome a stale plugin list, false if it |
62 // is up to date. This can be called from any thread. | 58 // is up to date. This can be called from any thread. |
63 virtual bool GetPluginInfoArray( | 59 virtual bool GetPluginInfoArray( |
64 const GURL& url, | 60 const GURL& url, |
65 const std::string& mime_type, | 61 const std::string& mime_type, |
66 bool allow_wildcard, | 62 bool allow_wildcard, |
67 std::vector<WebPluginInfo>* info, | 63 std::vector<WebPluginInfo>* info, |
68 std::vector<std::string>* actual_mime_types) = 0; | 64 std::vector<std::string>* actual_mime_types) = 0; |
69 | 65 |
(...skipping 29 matching lines...) Expand all Loading... |
99 | 95 |
100 // Returns information about a pepper plugin if it exists, otherwise nullptr. | 96 // Returns information about a pepper plugin if it exists, otherwise nullptr. |
101 // The caller does not own the pointer, and it's not guaranteed to live past | 97 // The caller does not own the pointer, and it's not guaranteed to live past |
102 // the call stack. | 98 // the call stack. |
103 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( | 99 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( |
104 const base::FilePath& plugin_path) = 0; | 100 const base::FilePath& plugin_path) = 0; |
105 | 101 |
106 virtual void SetFilter(PluginServiceFilter* filter) = 0; | 102 virtual void SetFilter(PluginServiceFilter* filter) = 0; |
107 virtual PluginServiceFilter* GetFilter() = 0; | 103 virtual PluginServiceFilter* GetFilter() = 0; |
108 | 104 |
109 // If the plugin with the given path is running, cleanly shuts it down. | |
110 virtual void ForcePluginShutdown(const base::FilePath& plugin_path) = 0; | |
111 | |
112 // Used to monitor plugin stability. An unstable plugin is one that has | 105 // Used to monitor plugin stability. An unstable plugin is one that has |
113 // crashed more than a set number of times in a set time period. | 106 // crashed more than a set number of times in a set time period. |
114 virtual bool IsPluginUnstable(const base::FilePath& plugin_path) = 0; | 107 virtual bool IsPluginUnstable(const base::FilePath& plugin_path) = 0; |
115 | 108 |
116 // Cause the plugin list to refresh next time they are accessed, regardless | 109 // Cause the plugin list to refresh next time they are accessed, regardless |
117 // of whether they are already loaded. | 110 // of whether they are already loaded. |
118 virtual void RefreshPlugins() = 0; | 111 virtual void RefreshPlugins() = 0; |
119 | 112 |
120 // Add/Remove an extra plugin to load when we actually do the loading. Must | |
121 // be called before the plugins have been loaded. | |
122 virtual void AddExtraPluginPath(const base::FilePath& path) = 0; | |
123 virtual void RemoveExtraPluginPath(const base::FilePath& path) = 0; | |
124 | |
125 // Same as above, but specifies a directory in which to search for plugins. | |
126 virtual void AddExtraPluginDir(const base::FilePath& path) = 0; | |
127 | |
128 // Register an internal plugin with the specified plugin information. | 113 // Register an internal plugin with the specified plugin information. |
129 // An internal plugin must be registered before it can | 114 // An internal plugin must be registered before it can |
130 // be loaded using PluginList::LoadPlugin(). | 115 // be loaded using PluginList::LoadPlugin(). |
131 // If |add_at_beginning| is true the plugin will be added earlier in | 116 // If |add_at_beginning| is true the plugin will be added earlier in |
132 // the list so that it can override the MIME types of older registrations. | 117 // the list so that it can override the MIME types of older registrations. |
133 virtual void RegisterInternalPlugin(const WebPluginInfo& info, | 118 virtual void RegisterInternalPlugin(const WebPluginInfo& info, |
134 bool add_at_beginning) = 0; | 119 bool add_at_beginning) = 0; |
135 | 120 |
136 // Removes a specified internal plugin from the list. The search will match | 121 // Removes a specified internal plugin from the list. The search will match |
137 // on the path from the version info previously registered. | 122 // on the path from the version info previously registered. |
138 virtual void UnregisterInternalPlugin(const base::FilePath& path) = 0; | 123 virtual void UnregisterInternalPlugin(const base::FilePath& path) = 0; |
139 | 124 |
140 // Gets a list of all the registered internal plugins. | 125 // Gets a list of all the registered internal plugins. |
141 virtual void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) = 0; | 126 virtual void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) = 0; |
142 | 127 |
143 // Returns true iff NPAPI plugins are supported on the current platform. | |
144 // This can be called from any thread. | |
145 virtual bool NPAPIPluginsSupported() = 0; | |
146 | |
147 // This is equivalent to specifying kDisablePluginsDiscovery, but is useful | |
148 // for unittests. | |
149 virtual void DisablePluginsDiscoveryForTesting() = 0; | |
150 | |
151 #if defined(OS_MACOSX) | |
152 // Called when the application is made active so that modal plugin windows can | |
153 // be made forward too. | |
154 virtual void AppActivated() = 0; | |
155 #endif | |
156 | |
157 // Returns true iff PPAPI "dev channel" methods are supported. | 128 // Returns true iff PPAPI "dev channel" methods are supported. |
158 virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, | 129 virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, |
159 const GURL& document_url) = 0; | 130 const GURL& document_url) = 0; |
160 }; | 131 }; |
161 | 132 |
162 } // namespace content | 133 } // namespace content |
163 | 134 |
164 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 135 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |