| 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 |
| 11 #include "ppapi/features/features.h" | 11 #include "ppapi/features/features.h" |
| 12 | 12 |
| 13 #if !BUILDFLAG(ENABLE_PLUGINS) | 13 #if !BUILDFLAG(ENABLE_PLUGINS) |
| 14 #error "Plugins should be enabled" | 14 #error "Plugins should be enabled" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #include <map> | 17 #include <map> |
| 18 #include <memory> | |
| 19 #include <set> | |
| 20 #include <vector> | 18 #include <vector> |
| 21 | 19 |
| 22 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
| 23 #include "base/macros.h" | 21 #include "base/macros.h" |
| 24 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" |
| 25 #include "base/memory/singleton.h" | 23 #include "base/memory/singleton.h" |
| 26 #include "base/sequence_checker.h" | 24 #include "base/sequence_checker.h" |
| 27 #include "base/sequenced_task_runner.h" | 25 #include "base/sequenced_task_runner.h" |
| 28 #include "base/synchronization/waitable_event_watcher.h" | 26 #include "base/synchronization/waitable_event_watcher.h" |
| 29 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 30 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 31 #include "content/browser/ppapi_plugin_process_host.h" | 29 #include "content/browser/ppapi_plugin_process_host.h" |
| 32 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
| 33 #include "content/public/browser/plugin_service.h" | 31 #include "content/public/browser/plugin_service.h" |
| 34 #include "content/public/common/pepper_plugin_info.h" | 32 #include "content/public/common/pepper_plugin_info.h" |
| 35 #include "ipc/ipc_channel_handle.h" | 33 #include "ipc/ipc_channel_handle.h" |
| 36 #include "url/gurl.h" | 34 #include "url/gurl.h" |
| 37 | 35 |
| 38 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 39 #include "base/win/registry.h" | 37 #include "base/win/registry.h" |
| 40 #endif | 38 #endif |
| 41 | 39 |
| 42 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) | 40 #if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID) |
| 43 #include "base/files/file_path_watcher.h" | 41 #include "base/files/file_path_watcher.h" |
| 44 #endif | 42 #endif |
| 45 | 43 |
| 46 namespace base { | |
| 47 class SingleThreadTaskRunner; | |
| 48 } | |
| 49 | |
| 50 namespace content { | 44 namespace content { |
| 51 class BrowserContext; | 45 class BrowserContext; |
| 52 class PluginServiceFilter; | 46 class PluginServiceFilter; |
| 53 class ResourceContext; | 47 class ResourceContext; |
| 54 struct PepperPluginInfo; | 48 struct PepperPluginInfo; |
| 55 | 49 |
| 56 class CONTENT_EXPORT PluginServiceImpl | 50 class CONTENT_EXPORT PluginServiceImpl |
| 57 : NON_EXPORTED_BASE(public PluginService) { | 51 : NON_EXPORTED_BASE(public PluginService) { |
| 58 public: | 52 public: |
| 59 // Returns the PluginServiceImpl singleton. | 53 // Returns the PluginServiceImpl singleton. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 const url::Origin& main_frame_origin, | 67 const url::Origin& main_frame_origin, |
| 74 const std::string& mime_type, | 68 const std::string& mime_type, |
| 75 bool allow_wildcard, | 69 bool allow_wildcard, |
| 76 bool* is_stale, | 70 bool* is_stale, |
| 77 WebPluginInfo* info, | 71 WebPluginInfo* info, |
| 78 std::string* actual_mime_type) override; | 72 std::string* actual_mime_type) override; |
| 79 bool GetPluginInfoByPath(const base::FilePath& plugin_path, | 73 bool GetPluginInfoByPath(const base::FilePath& plugin_path, |
| 80 WebPluginInfo* info) override; | 74 WebPluginInfo* info) override; |
| 81 base::string16 GetPluginDisplayNameByPath( | 75 base::string16 GetPluginDisplayNameByPath( |
| 82 const base::FilePath& path) override; | 76 const base::FilePath& path) override; |
| 83 void GetPlugins(const GetPluginsCallback& callback) override; | 77 void GetPlugins(GetPluginsCallback callback) override; |
| 84 PepperPluginInfo* GetRegisteredPpapiPluginInfo( | 78 PepperPluginInfo* GetRegisteredPpapiPluginInfo( |
| 85 const base::FilePath& plugin_path) override; | 79 const base::FilePath& plugin_path) override; |
| 86 void SetFilter(PluginServiceFilter* filter) override; | 80 void SetFilter(PluginServiceFilter* filter) override; |
| 87 PluginServiceFilter* GetFilter() override; | 81 PluginServiceFilter* GetFilter() override; |
| 88 bool IsPluginUnstable(const base::FilePath& plugin_path) override; | 82 bool IsPluginUnstable(const base::FilePath& plugin_path) override; |
| 89 void RefreshPlugins() override; | 83 void RefreshPlugins() override; |
| 90 void RegisterInternalPlugin(const WebPluginInfo& info, | 84 void RegisterInternalPlugin(const WebPluginInfo& info, |
| 91 bool add_at_beginning) override; | 85 bool add_at_beginning) override; |
| 92 void UnregisterInternalPlugin(const base::FilePath& path) override; | 86 void UnregisterInternalPlugin(const base::FilePath& path) override; |
| 93 void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) override; | 87 void GetInternalPlugins(std::vector<WebPluginInfo>* plugins) override; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // has been started by this service. Returns NULL if no process has been | 129 // has been started by this service. Returns NULL if no process has been |
| 136 // started. | 130 // started. |
| 137 PpapiPluginProcessHost* FindPpapiPluginProcess( | 131 PpapiPluginProcessHost* FindPpapiPluginProcess( |
| 138 const base::FilePath& plugin_path, | 132 const base::FilePath& plugin_path, |
| 139 const base::FilePath& profile_data_directory); | 133 const base::FilePath& profile_data_directory); |
| 140 PpapiPluginProcessHost* FindPpapiBrokerProcess( | 134 PpapiPluginProcessHost* FindPpapiBrokerProcess( |
| 141 const base::FilePath& broker_path); | 135 const base::FilePath& broker_path); |
| 142 | 136 |
| 143 void RegisterPepperPlugins(); | 137 void RegisterPepperPlugins(); |
| 144 | 138 |
| 145 // Run on the blocking pool to load the plugins synchronously. | 139 // Loads the plugins synchronously in a thread pool. |
| 146 void GetPluginsInternal(base::SingleThreadTaskRunner* target_task_runner, | 140 std::vector<WebPluginInfo> GetPluginsInternal(); |
| 147 const GetPluginsCallback& callback); | |
| 148 | 141 |
| 149 std::vector<PepperPluginInfo> ppapi_plugins_; | 142 std::vector<PepperPluginInfo> ppapi_plugins_; |
| 150 | 143 |
| 151 // Weak pointer; outlives us. | 144 // Weak pointer; outlives us. |
| 152 PluginServiceFilter* filter_; | 145 PluginServiceFilter* filter_; |
| 153 | 146 |
| 154 // Used to load plugins from disk. | 147 // Used to load plugins from disk. |
| 155 scoped_refptr<base::SequencedTaskRunner> plugin_list_task_runner_; | 148 scoped_refptr<base::SequencedTaskRunner> plugin_list_task_runner_; |
| 156 | 149 |
| 157 // Used to verify that loading plugins from disk is done sequentially. | 150 // Used to verify that loading plugins from disk is done sequentially. |
| 158 base::SequenceChecker plugin_list_sequence_checker_; | 151 base::SequenceChecker plugin_list_sequence_checker_; |
| 159 | 152 |
| 160 // Used to detect if a given plugin is crashing over and over. | 153 // Used to detect if a given plugin is crashing over and over. |
| 161 std::map<base::FilePath, std::vector<base::Time> > crash_times_; | 154 std::map<base::FilePath, std::vector<base::Time> > crash_times_; |
| 162 | 155 |
| 163 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); | 156 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); |
| 164 }; | 157 }; |
| 165 | 158 |
| 166 } // namespace content | 159 } // namespace content |
| 167 | 160 |
| 168 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 161 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
| OLD | NEW |