| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class ResourceContext; | 30 class ResourceContext; |
| 31 struct PepperPluginInfo; | 31 struct PepperPluginInfo; |
| 32 struct WebPluginInfo; | 32 struct WebPluginInfo; |
| 33 | 33 |
| 34 // This must be created on the main thread but it's only called on the IO/file | 34 // This must be created on the main thread but it's only called on the IO/file |
| 35 // thread. This is an asynchronous wrapper around the PluginList interface for | 35 // thread. This is an asynchronous wrapper around the PluginList interface for |
| 36 // querying plugin information. This must be used instead of that to avoid | 36 // querying plugin information. This must be used instead of that to avoid |
| 37 // doing expensive disk operations on the IO/UI threads. | 37 // doing expensive disk operations on the IO/UI threads. |
| 38 class PluginService { | 38 class PluginService { |
| 39 public: | 39 public: |
| 40 typedef base::Callback<void(const std::vector<WebPluginInfo>&)> | 40 using GetPluginsCallback = |
| 41 GetPluginsCallback; | 41 base::OnceCallback<void(const std::vector<WebPluginInfo>&)>; |
| 42 | 42 |
| 43 // Returns the PluginService singleton. | 43 // Returns the PluginService singleton. |
| 44 CONTENT_EXPORT static PluginService* GetInstance(); | 44 CONTENT_EXPORT static PluginService* GetInstance(); |
| 45 | 45 |
| 46 // Tells all the renderer processes associated with the given browser context | 46 // Tells all the renderer processes associated with the given browser context |
| 47 // to throw away their cache of the plugin list, and optionally also reload | 47 // to throw away their cache of the plugin list, and optionally also reload |
| 48 // all the pages with plugins. If |browser_context| is nullptr, purges the | 48 // all the pages with plugins. If |browser_context| is nullptr, purges the |
| 49 // cache in all renderers. | 49 // cache in all renderers. |
| 50 // NOTE: can only be called on the UI thread. | 50 // NOTE: can only be called on the UI thread. |
| 51 CONTENT_EXPORT static void PurgePluginListCache( | 51 CONTENT_EXPORT static void PurgePluginListCache( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, | 87 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, |
| 88 WebPluginInfo* info) = 0; | 88 WebPluginInfo* info) = 0; |
| 89 | 89 |
| 90 // Returns the display name for the plugin identified by the given path. If | 90 // Returns the display name for the plugin identified by the given path. If |
| 91 // the path doesn't identify a plugin, or the plugin has no display name, | 91 // the path doesn't identify a plugin, or the plugin has no display name, |
| 92 // this will attempt to generate a display name from the path. | 92 // this will attempt to generate a display name from the path. |
| 93 virtual base::string16 GetPluginDisplayNameByPath( | 93 virtual base::string16 GetPluginDisplayNameByPath( |
| 94 const base::FilePath& plugin_path) = 0; | 94 const base::FilePath& plugin_path) = 0; |
| 95 | 95 |
| 96 // Asynchronously loads plugins if necessary and then calls back to the | 96 // Asynchronously loads plugins if necessary and then calls back to the |
| 97 // provided function on the calling MessageLoop on completion. | 97 // provided function on the calling sequence on completion. |
| 98 virtual void GetPlugins(const GetPluginsCallback& callback) = 0; | 98 virtual void GetPlugins(GetPluginsCallback callback) = 0; |
| 99 | 99 |
| 100 // Returns information about a pepper plugin if it exists, otherwise nullptr. | 100 // 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 | 101 // The caller does not own the pointer, and it's not guaranteed to live past |
| 102 // the call stack. | 102 // the call stack. |
| 103 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( | 103 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( |
| 104 const base::FilePath& plugin_path) = 0; | 104 const base::FilePath& plugin_path) = 0; |
| 105 | 105 |
| 106 virtual void SetFilter(PluginServiceFilter* filter) = 0; | 106 virtual void SetFilter(PluginServiceFilter* filter) = 0; |
| 107 virtual PluginServiceFilter* GetFilter() = 0; | 107 virtual PluginServiceFilter* GetFilter() = 0; |
| 108 | 108 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 virtual void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) = 0; | 130 virtual void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) = 0; |
| 131 | 131 |
| 132 // Returns true iff PPAPI "dev channel" methods are supported. | 132 // Returns true iff PPAPI "dev channel" methods are supported. |
| 133 virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, | 133 virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, |
| 134 const GURL& document_url) = 0; | 134 const GURL& document_url) = 0; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace content | 137 } // namespace content |
| 138 | 138 |
| 139 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 139 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |