Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 } | 56 } |
| 57 | 57 |
| 58 // This must be created on the main thread but it's only called on the IO/file | 58 // This must be created on the main thread but it's only called on the IO/file |
| 59 // thread. This is an asynchronous wrapper around the PluginList interface for | 59 // thread. This is an asynchronous wrapper around the PluginList interface for |
| 60 // querying plugin information. This must be used instead of that to avoid | 60 // querying plugin information. This must be used instead of that to avoid |
| 61 // doing expensive disk operations on the IO/UI threads. | 61 // doing expensive disk operations on the IO/UI threads. |
| 62 class CONTENT_EXPORT PluginService | 62 class CONTENT_EXPORT PluginService |
| 63 : public base::WaitableEventWatcher::Delegate, | 63 : public base::WaitableEventWatcher::Delegate, |
| 64 public NotificationObserver { | 64 public NotificationObserver { |
| 65 public: | 65 public: |
| 66 struct OverriddenPlugin { | |
| 67 int render_process_id; | |
| 68 int render_view_id; | |
| 69 GURL url; // If empty, the override applies to all urls in render_view. | |
| 70 webkit::WebPluginInfo plugin; | |
| 71 }; | |
| 72 | |
| 73 typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> | 66 typedef base::Callback<void(const std::vector<webkit::WebPluginInfo>&)> |
| 74 GetPluginsCallback; | 67 GetPluginsCallback; |
| 75 typedef base::Callback<void(const std::vector<webkit::npapi::PluginGroup>&)> | 68 typedef base::Callback<void(const std::vector<webkit::npapi::PluginGroup>&)> |
| 76 GetPluginGroupsCallback; | 69 GetPluginGroupsCallback; |
| 77 | 70 |
| 78 // Returns the PluginService singleton. | 71 // Returns the PluginService singleton. |
| 79 static PluginService* GetInstance(); | 72 static PluginService* GetInstance(); |
| 80 | 73 |
| 81 // Starts watching for changes in the list of installed plug-ins. | 74 // Starts watching for changes in the list of installed plug-ins. |
| 82 void StartWatchingPlugins(); | 75 void StartWatchingPlugins(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 int render_view_id, | 119 int render_view_id, |
| 127 const content::ResourceContext& context, | 120 const content::ResourceContext& context, |
| 128 const GURL& url, | 121 const GURL& url, |
| 129 const GURL& page_url, | 122 const GURL& page_url, |
| 130 const std::string& mime_type, | 123 const std::string& mime_type, |
| 131 bool allow_wildcard, | 124 bool allow_wildcard, |
| 132 bool* use_stale, | 125 bool* use_stale, |
| 133 webkit::WebPluginInfo* info, | 126 webkit::WebPluginInfo* info, |
| 134 std::string* actual_mime_type); | 127 std::string* actual_mime_type); |
| 135 | 128 |
| 129 // Returns a list of all plug-ins that match the given URL and MIME type. | |
| 130 void GetMatchingPlugins( | |
|
jam
2011/09/27 16:51:34
nit: it seems that this is equivalent to GetPlugin
Bernhard Bauer
2011/09/27 21:21:39
That's why I tried to give it a more descriptive n
jam
2011/09/29 01:03:32
You lost me here :) I'm still not clear why GetPlu
Bernhard Bauer
2011/09/29 13:20:47
It's not, that's why I'd prefer to rename GetPlugi
jam
2011/09/29 16:31:10
Ok I think I understand your point now, which is t
| |
| 131 int render_process_id, | |
| 132 int render_view_id, | |
| 133 const content::ResourceContext& context, | |
| 134 const GURL& url, | |
| 135 const GURL& page_url, | |
| 136 const std::string& mime_type, | |
| 137 bool allow_wildcard, | |
| 138 bool* use_stale, | |
|
Robert Sesek
2011/09/29 01:09:48
This isn't going to work with the direction we're
jam
2011/09/29 01:13:49
right, I think Bernhard's change is from a revisio
Bernhard Bauer
2011/09/29 13:20:47
No, I did not get a CHECK :) Note that this is ess
jam
2011/09/29 16:31:10
hmm, probably because it was cached then.
| |
| 139 std::vector<webkit::WebPluginInfo>* plugins, | |
| 140 std::vector<std::string>* mime_types, | |
|
Robert Sesek
2011/09/29 01:09:48
I'm adding a function that is very similar to this
| |
| 141 std::vector<bool>* allowed); | |
| 142 | |
| 136 // Marks the plugin list as dirty and will cause the plugins to be reloaded | 143 // Marks the plugin list as dirty and will cause the plugins to be reloaded |
| 137 // on the next access through GetPlugins() or GetPluginGroups(). | 144 // on the next access through GetPlugins() or GetPluginGroups(). |
| 138 void RefreshPluginList(); | 145 void RefreshPluginList(); |
| 139 | 146 |
| 140 // Asynchronously loads plugins if necessary and then calls back to the | 147 // Asynchronously loads plugins if necessary and then calls back to the |
| 141 // provided function on the calling MessageLoop on completion. | 148 // provided function on the calling MessageLoop on completion. |
| 142 void GetPlugins(const GetPluginsCallback& callback); | 149 void GetPlugins(const GetPluginsCallback& callback); |
| 143 | 150 |
| 144 // Asynchronously loads the list of plugin groups if necessary and then calls | 151 // Asynchronously loads the list of plugin groups if necessary and then calls |
| 145 // back to the provided function on the calling MessageLoop on completion. | 152 // back to the provided function on the calling MessageLoop on completion. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 content::PluginServiceFilter* filter_; | 235 content::PluginServiceFilter* filter_; |
| 229 | 236 |
| 230 std::set<PluginProcessHost::Client*> pending_plugin_clients_; | 237 std::set<PluginProcessHost::Client*> pending_plugin_clients_; |
| 231 | 238 |
| 232 DISALLOW_COPY_AND_ASSIGN(PluginService); | 239 DISALLOW_COPY_AND_ASSIGN(PluginService); |
| 233 }; | 240 }; |
| 234 | 241 |
| 235 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); | 242 DISABLE_RUNNABLE_METHOD_REFCOUNT(PluginService); |
| 236 | 243 |
| 237 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ | 244 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_H_ |
| OLD | NEW |