diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 08:18:24 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 08:18:24 +0000 |
commit | 7a13e7926699ad5d03f2d6e121b7bdb68ca05680 (patch) | |
tree | bc0875a8673be9bd54b0c126b76cc4efdb200fa3 /chrome/browser | |
parent | d3f7e4fc4eedd2ec10877885cfd286aac1abacc6 (diff) | |
download | chromium_src-7a13e7926699ad5d03f2d6e121b7bdb68ca05680.zip chromium_src-7a13e7926699ad5d03f2d6e121b7bdb68ca05680.tar.gz chromium_src-7a13e7926699ad5d03f2d6e121b7bdb68ca05680.tar.bz2 |
Replace ViewHostMsg_GetPluginPath with ViewHostMsg_GetPluginInfo.
This enables the renderer to get more information about a plugin than just the path.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3015029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/plugin_service.cc | 30 | ||||
-rw-r--r-- | chrome/browser/plugin_service.h | 14 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 21 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.h | 5 |
4 files changed, 30 insertions, 40 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 1b36382..197a3ff 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -228,10 +228,13 @@ void PluginService::OpenChannelToPlugin( const std::wstring& locale, IPC::Message* reply_msg) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - // We don't need a policy URL here because that was already checked by a - // previous call to GetPluginPath. - GURL policy_url; - FilePath plugin_path = GetPluginPath(url, policy_url, mime_type, NULL); + bool allow_wildcard = true; + WebPluginInfo info; + FilePath plugin_path; + if (NPAPI::PluginList::Singleton()->GetPluginInfo( + url, mime_type, allow_wildcard, &info, NULL) && info.enabled) { + plugin_path = info.path; + } PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); if (plugin_host) { plugin_host->OpenChannelToPlugin(renderer_msg_filter, mime_type, reply_msg); @@ -241,21 +244,6 @@ void PluginService::OpenChannelToPlugin( } } -FilePath PluginService::GetPluginPath(const GURL& url, - const GURL& policy_url, - const std::string& mime_type, - std::string* actual_mime_type) { - bool allow_wildcard = true; - WebPluginInfo info; - if (NPAPI::PluginList::Singleton()->GetPluginInfo( - url, mime_type, allow_wildcard, &info, actual_mime_type) && - info.enabled && PluginAllowedForURL(info.path, policy_url)) { - return info.path; - } - - return FilePath(); -} - static void PurgePluginListCache(bool reload_pages) { for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); !it.IsAtEnd(); it.Advance()) { @@ -336,8 +324,8 @@ void PluginService::Observe(NotificationType type, } } -bool PluginService::PluginAllowedForURL(const FilePath& plugin_path, - const GURL& url) { +bool PluginService::PrivatePluginAllowedForURL(const FilePath& plugin_path, + const GURL& url) { if (url.is_empty()) return true; // Caller wants all plugins. diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h index 9745973..63513bd 100644 --- a/chrome/browser/plugin_service.h +++ b/chrome/browser/plugin_service.h @@ -83,13 +83,9 @@ class PluginService const std::wstring& locale, IPC::Message* reply_msg); - // Get the path to the plugin specified. policy_url is the URL of the page - // requesting the plugin, so we can verify whether the plugin is allowed - // on that page. - FilePath GetPluginPath(const GURL& url, - const GURL& policy_url, - const std::string& mime_type, - std::string* actual_mime_type); + // Returns true if the given plugin is allowed to be used by a page with + // the given URL. + bool PrivatePluginAllowedForURL(const FilePath& plugin_path, const GURL& url); // The UI thread's message loop MessageLoop* main_message_loop() { return main_message_loop_; } @@ -115,10 +111,6 @@ class PluginService virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); - // Returns true if the given plugin is allowed to be used by a page with - // the given URL. - bool PluginAllowedForURL(const FilePath& plugin_path, const GURL& url); - void RegisterPepperPlugins(); // mapping between plugin path and PluginProcessHost diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index db19895..3d60d80 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -366,7 +366,7 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_PreCacheFont, OnPreCacheFont) #endif IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) - IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPath, OnGetPluginPath) + IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginInfo, OnGetPluginInfo) IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ContextMenu, OnReceiveContextMenuMsg(msg)) @@ -692,13 +692,22 @@ void ResourceMessageFilter::OnGetPluginsOnFileThread( NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); } -void ResourceMessageFilter::OnGetPluginPath(const GURL& url, +void ResourceMessageFilter::OnGetPluginInfo(const GURL& url, const GURL& policy_url, const std::string& mime_type, - FilePath* filename, - std::string* url_mime_type) { - *filename = plugin_service_->GetPluginPath( - url, policy_url, mime_type, url_mime_type); + bool* found, + WebPluginInfo* info, + std::string* actual_mime_type) { + bool allow_wildcard = true; + *found = NPAPI::PluginList::Singleton()->GetPluginInfo(url, + mime_type, + allow_wildcard, + info, + actual_mime_type); + if (*found) { + info->enabled = info->enabled && + plugin_service_->PrivatePluginAllowedForURL(info->path, policy_url); + } } void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url, diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 7acecaa..c112b77 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -170,10 +170,11 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, #endif void OnGetPlugins(bool refresh, IPC::Message* reply_msg); void OnGetPluginsOnFileThread(bool refresh, IPC::Message* reply_msg); - void OnGetPluginPath(const GURL& url, + void OnGetPluginInfo(const GURL& url, const GURL& policy_url, const std::string& mime_type, - FilePath* filename, + bool* found, + WebPluginInfo* info, std::string* actual_mime_type); void OnOpenChannelToPlugin(const GURL& url, const std::string& mime_type, |