| 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/string16.h" | 12 #include "base/string16.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 | 14 |
| 15 class GURL; |
| 16 |
| 17 namespace base { |
| 15 class FilePath; | 18 class FilePath; |
| 16 class GURL; | 19 } |
| 17 | 20 |
| 18 namespace webkit { | 21 namespace webkit { |
| 19 struct WebPluginInfo; | 22 struct WebPluginInfo; |
| 20 namespace npapi { | 23 namespace npapi { |
| 21 class PluginList; | 24 class PluginList; |
| 22 } | 25 } |
| 23 } | 26 } |
| 24 | 27 |
| 25 namespace content { | 28 namespace content { |
| 26 | 29 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const GURL& page_url, | 82 const GURL& page_url, |
| 80 const std::string& mime_type, | 83 const std::string& mime_type, |
| 81 bool allow_wildcard, | 84 bool allow_wildcard, |
| 82 bool* is_stale, | 85 bool* is_stale, |
| 83 webkit::WebPluginInfo* info, | 86 webkit::WebPluginInfo* info, |
| 84 std::string* actual_mime_type) = 0; | 87 std::string* actual_mime_type) = 0; |
| 85 | 88 |
| 86 // Get plugin info by plugin path (including disabled plugins). Returns true | 89 // Get plugin info by plugin path (including disabled plugins). Returns true |
| 87 // if the plugin is found and WebPluginInfo has been filled in |info|. This | 90 // if the plugin is found and WebPluginInfo has been filled in |info|. This |
| 88 // will use cached data in the plugin list. | 91 // will use cached data in the plugin list. |
| 89 virtual bool GetPluginInfoByPath(const FilePath& plugin_path, | 92 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, |
| 90 webkit::WebPluginInfo* info) = 0; | 93 webkit::WebPluginInfo* info) = 0; |
| 91 | 94 |
| 92 // Returns the display name for the plugin identified by the given path. If | 95 // Returns the display name for the plugin identified by the given path. If |
| 93 // the path doesn't identify a plugin, or the plugin has no display name, | 96 // the path doesn't identify a plugin, or the plugin has no display name, |
| 94 // this will attempt to generate a display name from the path. | 97 // this will attempt to generate a display name from the path. |
| 95 virtual string16 GetPluginDisplayNameByPath(const FilePath& plugin_path) = 0; | 98 virtual string16 GetPluginDisplayNameByPath( |
| 99 const base::FilePath& plugin_path) = 0; |
| 96 | 100 |
| 97 // Asynchronously loads plugins if necessary and then calls back to the | 101 // Asynchronously loads plugins if necessary and then calls back to the |
| 98 // provided function on the calling MessageLoop on completion. | 102 // provided function on the calling MessageLoop on completion. |
| 99 virtual void GetPlugins(const GetPluginsCallback& callback) = 0; | 103 virtual void GetPlugins(const GetPluginsCallback& callback) = 0; |
| 100 | 104 |
| 101 // Returns information about a pepper plugin if it exists, otherwise NULL. | 105 // Returns information about a pepper plugin if it exists, otherwise NULL. |
| 102 // The caller does not own the pointer, and it's not guaranteed to live past | 106 // The caller does not own the pointer, and it's not guaranteed to live past |
| 103 // the call stack. | 107 // the call stack. |
| 104 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( | 108 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( |
| 105 const FilePath& plugin_path) = 0; | 109 const base::FilePath& plugin_path) = 0; |
| 106 | 110 |
| 107 virtual void SetFilter(PluginServiceFilter* filter) = 0; | 111 virtual void SetFilter(PluginServiceFilter* filter) = 0; |
| 108 virtual PluginServiceFilter* GetFilter() = 0; | 112 virtual PluginServiceFilter* GetFilter() = 0; |
| 109 | 113 |
| 110 // If the plugin with the given path is running, cleanly shuts it down. | 114 // If the plugin with the given path is running, cleanly shuts it down. |
| 111 virtual void ForcePluginShutdown(const FilePath& plugin_path) = 0; | 115 virtual void ForcePluginShutdown(const base::FilePath& plugin_path) = 0; |
| 112 | 116 |
| 113 // Used to monitor plug-in stability. An unstable plug-in is one that has | 117 // Used to monitor plug-in stability. An unstable plug-in is one that has |
| 114 // crashed more than a set number of times in a set time period. | 118 // crashed more than a set number of times in a set time period. |
| 115 virtual bool IsPluginUnstable(const FilePath& plugin_path) = 0; | 119 virtual bool IsPluginUnstable(const base::FilePath& plugin_path) = 0; |
| 116 | 120 |
| 117 // The following functions are wrappers around webkit::npapi::PluginList. | 121 // The following functions are wrappers around webkit::npapi::PluginList. |
| 118 // These must be used instead of those in order to ensure that we have a | 122 // These must be used instead of those in order to ensure that we have a |
| 119 // single global list in the component build and so that we don't | 123 // single global list in the component build and so that we don't |
| 120 // accidentally load plugins in the wrong process or thread. Refer to | 124 // accidentally load plugins in the wrong process or thread. Refer to |
| 121 // PluginList for further documentation of these functions. | 125 // PluginList for further documentation of these functions. |
| 122 virtual void RefreshPlugins() = 0; | 126 virtual void RefreshPlugins() = 0; |
| 123 virtual void AddExtraPluginPath(const FilePath& path) = 0; | 127 virtual void AddExtraPluginPath(const base::FilePath& path) = 0; |
| 124 virtual void AddExtraPluginDir(const FilePath& path) = 0; | 128 virtual void AddExtraPluginDir(const base::FilePath& path) = 0; |
| 125 virtual void RemoveExtraPluginPath(const FilePath& path) = 0; | 129 virtual void RemoveExtraPluginPath(const base::FilePath& path) = 0; |
| 126 virtual void UnregisterInternalPlugin(const FilePath& path) = 0; | 130 virtual void UnregisterInternalPlugin(const base::FilePath& path) = 0; |
| 127 virtual void RegisterInternalPlugin(const webkit::WebPluginInfo& info, | 131 virtual void RegisterInternalPlugin(const webkit::WebPluginInfo& info, |
| 128 bool add_at_beginning) = 0; | 132 bool add_at_beginning) = 0; |
| 129 virtual void GetInternalPlugins( | 133 virtual void GetInternalPlugins( |
| 130 std::vector<webkit::WebPluginInfo>* plugins) = 0; | 134 std::vector<webkit::WebPluginInfo>* plugins) = 0; |
| 131 | 135 |
| 132 // TODO(dpranke): This should be private. | 136 // TODO(dpranke): This should be private. |
| 133 virtual webkit::npapi::PluginList* GetPluginList() = 0; | 137 virtual webkit::npapi::PluginList* GetPluginList() = 0; |
| 134 | 138 |
| 135 virtual void SetPluginListForTesting( | 139 virtual void SetPluginListForTesting( |
| 136 webkit::npapi::PluginList* plugin_list) = 0; | 140 webkit::npapi::PluginList* plugin_list) = 0; |
| 137 | 141 |
| 138 #if defined(OS_MACOSX) | 142 #if defined(OS_MACOSX) |
| 139 // Called when the application is made active so that modal plugin windows can | 143 // Called when the application is made active so that modal plugin windows can |
| 140 // be made forward too. | 144 // be made forward too. |
| 141 virtual void AppActivated() = 0; | 145 virtual void AppActivated() = 0; |
| 142 #endif | 146 #endif |
| 143 }; | 147 }; |
| 144 | 148 |
| 145 } // namespace content | 149 } // namespace content |
| 146 | 150 |
| 147 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 151 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |