| 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 // 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_IMPL_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ResourceContext* resource_context; | 62 ResourceContext* resource_context; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class CONTENT_EXPORT PluginServiceImpl | 65 class CONTENT_EXPORT PluginServiceImpl |
| 66 : NON_EXPORTED_BASE(public PluginService) { | 66 : NON_EXPORTED_BASE(public PluginService) { |
| 67 public: | 67 public: |
| 68 // Returns the PluginServiceImpl singleton. | 68 // Returns the PluginServiceImpl singleton. |
| 69 static PluginServiceImpl* GetInstance(); | 69 static PluginServiceImpl* GetInstance(); |
| 70 | 70 |
| 71 // PluginService implementation: | 71 // PluginService implementation: |
| 72 virtual void Init() override; | 72 void Init() override; |
| 73 virtual void StartWatchingPlugins() override; | 73 void StartWatchingPlugins() override; |
| 74 virtual bool GetPluginInfoArray( | 74 bool GetPluginInfoArray(const GURL& url, |
| 75 const GURL& url, | 75 const std::string& mime_type, |
| 76 const std::string& mime_type, | 76 bool allow_wildcard, |
| 77 bool allow_wildcard, | 77 std::vector<WebPluginInfo>* info, |
| 78 std::vector<WebPluginInfo>* info, | 78 std::vector<std::string>* actual_mime_types) override; |
| 79 std::vector<std::string>* actual_mime_types) override; | 79 bool GetPluginInfo(int render_process_id, |
| 80 virtual bool GetPluginInfo(int render_process_id, | 80 int render_frame_id, |
| 81 int render_frame_id, | 81 ResourceContext* context, |
| 82 ResourceContext* context, | 82 const GURL& url, |
| 83 const GURL& url, | 83 const GURL& page_url, |
| 84 const GURL& page_url, | 84 const std::string& mime_type, |
| 85 const std::string& mime_type, | 85 bool allow_wildcard, |
| 86 bool allow_wildcard, | 86 bool* is_stale, |
| 87 bool* is_stale, | 87 WebPluginInfo* info, |
| 88 WebPluginInfo* info, | 88 std::string* actual_mime_type) override; |
| 89 std::string* actual_mime_type) override; | 89 bool GetPluginInfoByPath(const base::FilePath& plugin_path, |
| 90 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, | 90 WebPluginInfo* info) override; |
| 91 WebPluginInfo* info) override; | 91 base::string16 GetPluginDisplayNameByPath( |
| 92 virtual base::string16 GetPluginDisplayNameByPath( | |
| 93 const base::FilePath& path) override; | 92 const base::FilePath& path) override; |
| 94 virtual void GetPlugins(const GetPluginsCallback& callback) override; | 93 void GetPlugins(const GetPluginsCallback& callback) override; |
| 95 virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( | 94 PepperPluginInfo* GetRegisteredPpapiPluginInfo( |
| 96 const base::FilePath& plugin_path) override; | 95 const base::FilePath& plugin_path) override; |
| 97 virtual void SetFilter(PluginServiceFilter* filter) override; | 96 void SetFilter(PluginServiceFilter* filter) override; |
| 98 virtual PluginServiceFilter* GetFilter() override; | 97 PluginServiceFilter* GetFilter() override; |
| 99 virtual void ForcePluginShutdown(const base::FilePath& plugin_path) override; | 98 void ForcePluginShutdown(const base::FilePath& plugin_path) override; |
| 100 virtual bool IsPluginUnstable(const base::FilePath& plugin_path) override; | 99 bool IsPluginUnstable(const base::FilePath& plugin_path) override; |
| 101 virtual void RefreshPlugins() override; | 100 void RefreshPlugins() override; |
| 102 virtual void AddExtraPluginPath(const base::FilePath& path) override; | 101 void AddExtraPluginPath(const base::FilePath& path) override; |
| 103 virtual void RemoveExtraPluginPath(const base::FilePath& path) override; | 102 void RemoveExtraPluginPath(const base::FilePath& path) override; |
| 104 virtual void AddExtraPluginDir(const base::FilePath& path) override; | 103 void AddExtraPluginDir(const base::FilePath& path) override; |
| 105 virtual void RegisterInternalPlugin( | 104 void RegisterInternalPlugin(const WebPluginInfo& info, |
| 106 const WebPluginInfo& info, bool add_at_beginning) override; | 105 bool add_at_beginning) override; |
| 107 virtual void UnregisterInternalPlugin(const base::FilePath& path) override; | 106 void UnregisterInternalPlugin(const base::FilePath& path) override; |
| 108 virtual void GetInternalPlugins( | 107 void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) override; |
| 109 std::vector<WebPluginInfo>* plugins) override; | 108 bool NPAPIPluginsSupported() override; |
| 110 virtual bool NPAPIPluginsSupported() override; | 109 void DisablePluginsDiscoveryForTesting() override; |
| 111 virtual void DisablePluginsDiscoveryForTesting() override; | |
| 112 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 113 virtual void AppActivated() override; | 111 void AppActivated() override; |
| 114 #elif defined(OS_WIN) | 112 #elif defined(OS_WIN) |
| 115 virtual bool GetPluginInfoFromWindow(HWND window, | 113 virtual bool GetPluginInfoFromWindow(HWND window, |
| 116 base::string16* plugin_name, | 114 base::string16* plugin_name, |
| 117 base::string16* plugin_version) override; | 115 base::string16* plugin_version) override; |
| 118 | 116 |
| 119 // Returns true iff the given HWND is a plugin. | 117 // Returns true iff the given HWND is a plugin. |
| 120 bool IsPluginWindow(HWND window); | 118 bool IsPluginWindow(HWND window); |
| 121 #endif | 119 #endif |
| 122 virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, | 120 bool PpapiDevChannelSupported(BrowserContext* browser_context, |
| 123 const GURL& document_url) override; | 121 const GURL& document_url) override; |
| 124 | 122 |
| 125 // Returns the plugin process host corresponding to the plugin process that | 123 // Returns the plugin process host corresponding to the plugin process that |
| 126 // has been started by this service. This will start a process to host the | 124 // has been started by this service. This will start a process to host the |
| 127 // 'plugin_path' if needed. If the process fails to start, the return value | 125 // 'plugin_path' if needed. If the process fails to start, the return value |
| 128 // is NULL. Must be called on the IO thread. | 126 // is NULL. Must be called on the IO thread. |
| 129 PluginProcessHost* FindOrStartNpapiPluginProcess( | 127 PluginProcessHost* FindOrStartNpapiPluginProcess( |
| 130 int render_process_id, const base::FilePath& plugin_path); | 128 int render_process_id, const base::FilePath& plugin_path); |
| 131 PpapiPluginProcessHost* FindOrStartPpapiPluginProcess( | 129 PpapiPluginProcessHost* FindOrStartPpapiPluginProcess( |
| 132 int render_process_id, | 130 int render_process_id, |
| 133 const base::FilePath& plugin_path, | 131 const base::FilePath& plugin_path, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 157 | 155 |
| 158 // Used to monitor plug-in stability. | 156 // Used to monitor plug-in stability. |
| 159 void RegisterPluginCrash(const base::FilePath& plugin_path); | 157 void RegisterPluginCrash(const base::FilePath& plugin_path); |
| 160 | 158 |
| 161 private: | 159 private: |
| 162 friend struct DefaultSingletonTraits<PluginServiceImpl>; | 160 friend struct DefaultSingletonTraits<PluginServiceImpl>; |
| 163 | 161 |
| 164 // Creates the PluginServiceImpl object, but doesn't actually build the plugin | 162 // Creates the PluginServiceImpl object, but doesn't actually build the plugin |
| 165 // list yet. It's generated lazily. | 163 // list yet. It's generated lazily. |
| 166 PluginServiceImpl(); | 164 PluginServiceImpl(); |
| 167 virtual ~PluginServiceImpl(); | 165 ~PluginServiceImpl() override; |
| 168 | 166 |
| 169 #if defined(OS_WIN) | 167 #if defined(OS_WIN) |
| 170 void OnKeyChanged(base::win::RegKey* key); | 168 void OnKeyChanged(base::win::RegKey* key); |
| 171 #endif | 169 #endif |
| 172 | 170 |
| 173 // Returns the plugin process host corresponding to the plugin process that | 171 // Returns the plugin process host corresponding to the plugin process that |
| 174 // has been started by this service. Returns NULL if no process has been | 172 // has been started by this service. Returns NULL if no process has been |
| 175 // started. | 173 // started. |
| 176 PluginProcessHost* FindNpapiPluginProcess(const base::FilePath& plugin_path); | 174 PluginProcessHost* FindNpapiPluginProcess(const base::FilePath& plugin_path); |
| 177 PpapiPluginProcessHost* FindPpapiPluginProcess( | 175 PpapiPluginProcessHost* FindPpapiPluginProcess( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 246 |
| 249 // Used to detect if a given plug-in is crashing over and over. | 247 // Used to detect if a given plug-in is crashing over and over. |
| 250 std::map<base::FilePath, std::vector<base::Time> > crash_times_; | 248 std::map<base::FilePath, std::vector<base::Time> > crash_times_; |
| 251 | 249 |
| 252 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); | 250 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); |
| 253 }; | 251 }; |
| 254 | 252 |
| 255 } // namespace content | 253 } // namespace content |
| 256 | 254 |
| 257 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 255 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| OLD | NEW |