| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_PLUGIN_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_PLUGIN_SERVICE_H_ |
| 9 #define CHROME_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CHROME_BROWSER_PLUGIN_SERVICE_H_ |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Opens a channel to a plugin process for the given mime type, starting | 77 // Opens a channel to a plugin process for the given mime type, starting |
| 78 // a new plugin process if necessary. This must be called on the IO thread | 78 // a new plugin process if necessary. This must be called on the IO thread |
| 79 // or else a deadlock can occur. | 79 // or else a deadlock can occur. |
| 80 void OpenChannelToPlugin(ResourceMessageFilter* renderer_msg_filter, | 80 void OpenChannelToPlugin(ResourceMessageFilter* renderer_msg_filter, |
| 81 const GURL& url, | 81 const GURL& url, |
| 82 const std::string& mime_type, | 82 const std::string& mime_type, |
| 83 const std::wstring& locale, | 83 const std::wstring& locale, |
| 84 IPC::Message* reply_msg); | 84 IPC::Message* reply_msg); |
| 85 | 85 |
| 86 // Get the path to the plugin specified. policy_url is the URL of the page | 86 // Returns true if the given plugin is allowed to be used by a page with |
| 87 // requesting the plugin, so we can verify whether the plugin is allowed | 87 // the given URL. |
| 88 // on that page. | 88 bool PrivatePluginAllowedForURL(const FilePath& plugin_path, const GURL& url); |
| 89 FilePath GetPluginPath(const GURL& url, | |
| 90 const GURL& policy_url, | |
| 91 const std::string& mime_type, | |
| 92 std::string* actual_mime_type); | |
| 93 | 89 |
| 94 // The UI thread's message loop | 90 // The UI thread's message loop |
| 95 MessageLoop* main_message_loop() { return main_message_loop_; } | 91 MessageLoop* main_message_loop() { return main_message_loop_; } |
| 96 | 92 |
| 97 ResourceDispatcherHost* resource_dispatcher_host() const { | 93 ResourceDispatcherHost* resource_dispatcher_host() const { |
| 98 return resource_dispatcher_host_; | 94 return resource_dispatcher_host_; |
| 99 } | 95 } |
| 100 | 96 |
| 101 static void EnableChromePlugins(bool enable); | 97 static void EnableChromePlugins(bool enable); |
| 102 | 98 |
| 103 private: | 99 private: |
| 104 friend struct DefaultSingletonTraits<PluginService>; | 100 friend struct DefaultSingletonTraits<PluginService>; |
| 105 | 101 |
| 106 // Creates the PluginService object, but doesn't actually build the plugin | 102 // Creates the PluginService object, but doesn't actually build the plugin |
| 107 // list yet. It's generated lazily. | 103 // list yet. It's generated lazily. |
| 108 PluginService(); | 104 PluginService(); |
| 109 ~PluginService(); | 105 ~PluginService(); |
| 110 | 106 |
| 111 // base::WaitableEventWatcher::Delegate implementation. | 107 // base::WaitableEventWatcher::Delegate implementation. |
| 112 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 108 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| 113 | 109 |
| 114 // NotificationObserver implementation | 110 // NotificationObserver implementation |
| 115 virtual void Observe(NotificationType type, const NotificationSource& source, | 111 virtual void Observe(NotificationType type, const NotificationSource& source, |
| 116 const NotificationDetails& details); | 112 const NotificationDetails& details); |
| 117 | 113 |
| 118 // Returns true if the given plugin is allowed to be used by a page with | |
| 119 // the given URL. | |
| 120 bool PluginAllowedForURL(const FilePath& plugin_path, const GURL& url); | |
| 121 | |
| 122 void RegisterPepperPlugins(); | 114 void RegisterPepperPlugins(); |
| 123 | 115 |
| 124 // mapping between plugin path and PluginProcessHost | 116 // mapping between plugin path and PluginProcessHost |
| 125 typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap; | 117 typedef base::hash_map<FilePath, PluginProcessHost*> PluginMap; |
| 126 PluginMap plugin_hosts_; | 118 PluginMap plugin_hosts_; |
| 127 | 119 |
| 128 // The main thread's message loop. | 120 // The main thread's message loop. |
| 129 MessageLoop* main_message_loop_; | 121 MessageLoop* main_message_loop_; |
| 130 | 122 |
| 131 // The IO thread's resource dispatcher host. | 123 // The IO thread's resource dispatcher host. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 154 base::WaitableEventWatcher hklm_watcher_; | 146 base::WaitableEventWatcher hklm_watcher_; |
| 155 #endif | 147 #endif |
| 156 | 148 |
| 157 // Set to true if chrome plugins are enabled. Defaults to true. | 149 // Set to true if chrome plugins are enabled. Defaults to true. |
| 158 static bool enable_chrome_plugins_; | 150 static bool enable_chrome_plugins_; |
| 159 | 151 |
| 160 DISALLOW_COPY_AND_ASSIGN(PluginService); | 152 DISALLOW_COPY_AND_ASSIGN(PluginService); |
| 161 }; | 153 }; |
| 162 | 154 |
| 163 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ | 155 #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |