diff options
-rw-r--r-- | chrome/browser/plugin_service.cc | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 54 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.h | 18 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 41 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 77 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.cc | 162 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.h | 42 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 6 |
9 files changed, 216 insertions, 191 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index e42c2ae..d067167 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -246,13 +246,15 @@ void PluginService::OpenChannelToPlugin( const std::string& locale, IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + bool allow_wildcard = true; WebPluginInfo info; FilePath plugin_path; if (NPAPI::PluginList::Singleton()->GetPluginInfo( - url, mime_type, allow_wildcard, &info, NULL) && info.enabled) { + 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); diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 1c5e569..c941d1e 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -406,8 +406,8 @@ 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_DELAY_REPLY(ViewHostMsg_GetPluginInfo, - OnGetPluginInfo) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPluginInfoArray, + OnGetPluginInfoArray) IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ContextMenu, OnReceiveContextMenuMsg(msg)) @@ -759,10 +759,10 @@ void ResourceMessageFilter::OnGetPluginsOnFileThread( NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); } -void ResourceMessageFilter::OnGetPluginInfo(const GURL& url, - const GURL& policy_url, - const std::string& mime_type, - IPC::Message* reply_msg) { +void ResourceMessageFilter::OnGetPluginInfoArray(const GURL& url, + const GURL& policy_url, + const std::string& mime_type, + IPC::Message* reply_msg) { // The PluginList::GetPluginInfo may need to load the plugins. Don't do it // on the IO thread. BrowserThread::PostTask( @@ -777,37 +777,41 @@ void ResourceMessageFilter::OnGetPluginInfoOnFileThread( const GURL& policy_url, const std::string& mime_type, IPC::Message* reply_msg) { - WebPluginInfo info; - std::string actual_mime_type; + std::vector<WebPluginInfo> info; + std::vector<std::string> actual_mime_types; bool allow_wildcard = true; - bool found = NPAPI::PluginList::Singleton()->GetPluginInfo( - url, mime_type, allow_wildcard, &info, &actual_mime_type); + NPAPI::PluginList::Singleton()->GetPluginInfoArray( + url, mime_type, allow_wildcard, &info, &actual_mime_types); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableMethod( this, &ResourceMessageFilter::OnGotPluginInfo, - found, info, actual_mime_type, policy_url, reply_msg)); -} - -void ResourceMessageFilter::OnGotPluginInfo(bool found, - WebPluginInfo info, - const std::string& actual_mime_type, - const GURL& policy_url, - IPC::Message* reply_msg) { - ContentSetting setting = CONTENT_SETTING_DEFAULT; - if (found) { - info.enabled = info.enabled && - plugin_service_->PrivatePluginAllowedForURL(info.path, policy_url); + info, actual_mime_types, policy_url, reply_msg)); +} + +void ResourceMessageFilter::OnGotPluginInfo( + std::vector<WebPluginInfo> info, + const std::vector<std::string>& actual_mime_types, + const GURL& policy_url, + IPC::Message* reply_msg) { + std::vector<ContentSetting> settings; + for (std::vector<WebPluginInfo>::iterator iter = info.begin(); + iter != info.end(); ++iter) { + ContentSetting setting = CONTENT_SETTING_DEFAULT; + WebPluginInfo& item(*iter); + item.enabled = item.enabled && + plugin_service_->PrivatePluginAllowedForURL(item.path, policy_url); HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); - scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info)); + scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(item)); std::string resource = group->identifier(); setting = map->GetContentSetting(policy_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource); + settings.push_back(setting); } - ViewHostMsg_GetPluginInfo::WriteReplyParams( - reply_msg, found, info, setting, actual_mime_type); + ViewHostMsg_GetPluginInfoArray::WriteReplyParams( + reply_msg, info, settings, actual_mime_types); Send(reply_msg); } diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 0123ce6..b4382ff 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -180,19 +180,19 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, #endif void OnGetPlugins(bool refresh, IPC::Message* reply_msg); void OnGetPluginsOnFileThread(bool refresh, IPC::Message* reply_msg); - void OnGetPluginInfo(const GURL& url, - const GURL& policy_url, - const std::string& mime_type, - IPC::Message* reply_msg); + void OnGetPluginInfoArray(const GURL& url, + const GURL& policy_url, + const std::string& mime_type, + IPC::Message* reply_msg); void OnGetPluginInfoOnFileThread(const GURL& url, const GURL& policy_url, const std::string& mime_type, IPC::Message* reply_msg); - void OnGotPluginInfo(bool found, - WebPluginInfo info, - const std::string& actual_mime_type, - const GURL& policy_url, - IPC::Message* reply_msg); + void OnGotPluginInfo( + std::vector<WebPluginInfo> info, + const std::vector<std::string>& actual_mime_types, + const GURL& policy_url, + IPC::Message* reply_msg); void OnOpenChannelToPlugin(const GURL& url, const std::string& mime_type, const std::string& locale, diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index b30be05..41622ec 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1365,27 +1365,32 @@ IPC_BEGIN_MESSAGES(ViewHost) bool /* refresh*/, std::vector<WebPluginInfo> /* plugins */) - // Return information about a plugin for the given URL and MIME type. If there - // is no matching plugin, |found| is set to false. - // If |enabled| in the WebPluginInfo struct is false, the plug-in is basically - // treated as if it was not installed at all. - // If |setting| is set to CONTENT_SETTING_BLOCK, the plug-in is blocked by the - // content settings for |policy_url|. It still appears in navigator.plugins in - // Javascript though, and can be loaded via click-to-play. - // If |setting| is set to CONTENT_SETTING_ALLOW, the domain is explicitly - // white-listed for the plug-in, or the user has chosen not to block - // nonsandboxed plugins. - // If |setting| is set to CONTENT_SETTING_DEFAULT, the plug-in is neither - // blocked nor white-listed, which means that it's allowed by default and - // can still be blocked if it's non-sandboxed. - IPC_SYNC_MESSAGE_CONTROL3_4(ViewHostMsg_GetPluginInfo, + // Return information about a plugin for the given URL and MIME + // type. If there is no matching plugin, |info| is an empty vector. + // If |enabled| in the WebPluginInfo struct is false, the plug-in is + // basically treated as if it was not installed at all. + // |settings| has an entry for each item in |info|. + // If the corresponding |settings| array element is set to + // CONTENT_SETTING_BLOCK, the plug-in is blocked by the content + // settings for |policy_url|. It still appears in navigator.plugins + // in Javascript though, and can be loaded via click-to-play. + // If the corresponding |settings| array element is set to + // CONTENT_SETTING_ALLOW, the domain is explicitly white-listed for + // the plug-in, or the user has chosen not to block nonsandboxed + // plugins. + // If the corresponding |settings| array element is set to + // CONTENT_SETTING_DEFAULT, the plug-in is neither blocked nor + // white-listed, which means that it's allowed by default and can + // still be blocked if it's non-sandboxed. + // |actual_mime_types| is a list of actual mime types supported by + // each plugin found that match the URL given (one for each item in |info|). + IPC_SYNC_MESSAGE_CONTROL3_3(ViewHostMsg_GetPluginInfoArray, GURL /* url */, GURL /* policy_url */, std::string /* mime_type */, - bool /* found */, - WebPluginInfo /* plugin info */, - ContentSetting /* setting */, - std::string /* actual_mime_type */) + std::vector<WebPluginInfo> /* plugin info */, + std::vector<ContentSetting> /* settings */, + std::vector<std::string> /* actual_mime_types */) // Requests spellcheck for a word. IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_SpellCheck, diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 2673947..5bf7827 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -565,21 +565,22 @@ void RenderView::PluginCrashed(const FilePath& plugin_path) { WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, const WebPluginParams& params) { - WebPluginInfo info; - bool found; - ContentSetting setting; - std::string mime_type; - Send(new ViewHostMsg_GetPluginInfo( - params.url, frame->top()->url(), params.mimeType.utf8(), &found, - &info, &setting, &mime_type)); - if (!found || !info.enabled) + std::vector<WebPluginInfo> info; + std::vector<ContentSetting> settings; + std::vector<std::string> mime_types; + Send(new ViewHostMsg_GetPluginInfoArray( + params.url, frame->top()->url(), params.mimeType.utf8(), + &info, &settings, &mime_types)); + + // Select the first plugin returned, but only if it's enabled. + if (info.empty() || !info[0].enabled) return NULL; scoped_refptr<pepper::PluginModule> pepper_module = - PepperPluginRegistry::GetInstance()->GetModule(info.path); + PepperPluginRegistry::GetInstance()->GetModule(info[0].path); if (pepper_module) - return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); + return CreatePepperPlugin(frame, params, info[0].path, pepper_module.get()); else - return CreateNPAPIPlugin(frame, params, info.path, mime_type); + return CreateNPAPIPlugin(frame, params, info[0].path, mime_types[0]); } void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { @@ -2372,28 +2373,27 @@ void RenderView::runModal() { WebPlugin* RenderView::createPlugin(WebFrame* frame, const WebPluginParams& params) { - bool found = false; - ContentSetting setting = CONTENT_SETTING_DEFAULT; + std::vector<ContentSetting> settings; CommandLine* cmd = CommandLine::ForCurrentProcess(); - WebPluginInfo info; + std::vector<WebPluginInfo> info; GURL url(params.url); - std::string actual_mime_type; - Send(new ViewHostMsg_GetPluginInfo(url, - frame->top()->url(), - params.mimeType.utf8(), - &found, - &info, - &setting, - &actual_mime_type)); - - if (!found) + std::vector<std::string> actual_mime_types; + Send(new ViewHostMsg_GetPluginInfoArray(url, + frame->top()->url(), + params.mimeType.utf8(), + &info, + &settings, + &actual_mime_types)); + + if (info.empty()) return NULL; - DCHECK(setting != CONTENT_SETTING_DEFAULT); - scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info)); - group->AddPlugin(info, 0); + DCHECK(settings[0] != CONTENT_SETTING_DEFAULT); - if (!info.enabled) { + scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info[0])); + group->AddPlugin(info[0], 0); + + if (!info[0].enabled) { if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) && group->IsVulnerable()) { Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, @@ -2404,17 +2404,17 @@ WebPlugin* RenderView::createPlugin(WebFrame* frame, return NULL; } - if (info.path.value() == kDefaultPluginLibraryName || - setting == CONTENT_SETTING_ALLOW) { + if (info[0].path.value() == kDefaultPluginLibraryName || + settings[0] == CONTENT_SETTING_ALLOW) { scoped_refptr<pepper::PluginModule> pepper_module = - PepperPluginRegistry::GetInstance()->GetModule(info.path); + PepperPluginRegistry::GetInstance()->GetModule(info[0].path); if (pepper_module) { return CreatePepperPlugin(frame, params, - info.path, + info[0].path, pepper_module.get()); } - return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); + return CreateNPAPIPlugin(frame, params, info[0].path, actual_mime_types[0]); } std::string resource; if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) @@ -2422,13 +2422,14 @@ WebPlugin* RenderView::createPlugin(WebFrame* frame, DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); int resource_id; int message_id; - if (setting == CONTENT_SETTING_ASK) { + if (settings[0] == CONTENT_SETTING_ASK) { resource_id = IDR_BLOCKED_PLUGIN_HTML; message_id = IDS_PLUGIN_LOAD; } else { resource_id = IDR_OUTDATED_PLUGIN_HTML; message_id = IDS_PLUGIN_BLOCKED; } + // |blocked_plugin| will delete itself when the WebViewPlugin // is destroyed. BlockedPlugin* blocked_plugin = @@ -4058,12 +4059,8 @@ WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, const WebPluginParams& params, const FilePath& path, const std::string& mime_type) { - std::string actual_mime_type(mime_type); - if (actual_mime_type.empty()) - actual_mime_type = params.mimeType.utf8(); - - return new webkit_glue::WebPluginImpl(frame, params, path, - actual_mime_type, AsWeakPtr()); + return new webkit_glue::WebPluginImpl( + frame, params, path, mime_type, AsWeakPtr()); } WebPlugin* RenderView::CreateOutdatedPluginPlaceholder( diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index f312ab8..30e74b1 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -307,65 +307,6 @@ void PluginList::LoadPlugin(const FilePath& path, plugins->push_back(plugin_info); } -bool PluginList::FindPlugin(const std::string& mime_type, - bool allow_wildcard, - WebPluginInfo* info) { - DCHECK(mime_type == StringToLowerASCII(mime_type)); - - LoadPlugins(false); - AutoLock lock(lock_); - for (size_t i = 0; i < plugins_.size(); ++i) { - if (plugins_[i].enabled && - SupportsType(plugins_[i], mime_type, allow_wildcard)) { - *info = plugins_[i]; - return true; - } - } - - return false; -} - -bool PluginList::FindDisabledPlugin(const std::string& mime_type, - bool allow_wildcard, - WebPluginInfo* info) { - DCHECK(mime_type == StringToLowerASCII(mime_type)); - - LoadPlugins(false); - AutoLock lock(lock_); - for (size_t i = 0; i < plugins_.size(); ++i) { - if (!plugins_[i].enabled && - SupportsType(plugins_[i], mime_type, allow_wildcard)) { - *info = plugins_[i]; - return true; - } - } - - return false; -} - -bool PluginList::FindPlugin(const GURL &url, - std::string* actual_mime_type, - WebPluginInfo* info) { - LoadPlugins(false); - AutoLock lock(lock_); - std::string path = url.path(); - std::string::size_type last_dot = path.rfind('.'); - if (last_dot == std::string::npos) - return false; - - std::string extension = StringToLowerASCII(std::string(path, last_dot+1)); - - for (size_t i = 0; i < plugins_.size(); ++i) { - if (plugins_[i].enabled && - SupportsExtension(plugins_[i], extension, actual_mime_type)) { - *info = plugins_[i]; - return true; - } - } - - return false; -} - bool PluginList::SupportsType(const WebPluginInfo& info, const std::string &mime_type, bool allow_wildcard) { @@ -424,20 +365,109 @@ void PluginList::GetEnabledPlugins(bool refresh, } } +void PluginList::GetPluginInfoArray(const GURL& url, + const std::string& mime_type, + bool allow_wildcard, + std::vector<WebPluginInfo>* info, + std::vector<std::string>* actual_mime_types) { + DCHECK(mime_type == StringToLowerASCII(mime_type)); + DCHECK(info); + + LoadPlugins(false); + AutoLock lock(lock_); + info->clear(); + if (actual_mime_types) + actual_mime_types->clear(); + + std::set<FilePath> visited_plugins; + + // Add in enabled plugins by mime type. + WebPluginInfo default_plugin; + for (size_t i = 0; i < plugins_.size(); ++i) { + if (plugins_[i].enabled && + SupportsType(plugins_[i], mime_type, allow_wildcard)) { + FilePath path = plugins_[i].path; + if (path.value() != kDefaultPluginLibraryName && + visited_plugins.insert(path).second) { + info->push_back(plugins_[i]); + if (actual_mime_types) + actual_mime_types->push_back(mime_type); + } + } + } + + // Add in enabled plugins by url. + std::string path = url.path(); + std::string::size_type last_dot = path.rfind('.'); + if (last_dot != std::string::npos) { + std::string extension = StringToLowerASCII(std::string(path, last_dot+1)); + std::string actual_mime_type; + for (size_t i = 0; i < plugins_.size(); ++i) { + if (plugins_[i].enabled && + SupportsExtension(plugins_[i], extension, &actual_mime_type)) { + FilePath path = plugins_[i].path; + if (path.value() != kDefaultPluginLibraryName && + visited_plugins.insert(path).second) { + info->push_back(plugins_[i]); + if (actual_mime_types) + actual_mime_types->push_back(actual_mime_type); + } + } + } + } + + // Add in disabled plugins by mime type. + for (size_t i = 0; i < plugins_.size(); ++i) { + if (!plugins_[i].enabled && + SupportsType(plugins_[i], mime_type, allow_wildcard)) { + FilePath path = plugins_[i].path; + if (path.value() != kDefaultPluginLibraryName && + visited_plugins.insert(path).second) { + info->push_back(plugins_[i]); + if (actual_mime_types) + actual_mime_types->push_back(mime_type); + } + } + } + + // Add the default plugin at the end if it supports the mime type given. + if (!plugins_.empty()) { + const WebPluginInfo& default_info = plugins_.back(); + DCHECK(default_info.path.value() == kDefaultPluginLibraryName); + if (SupportsType(default_info, mime_type, allow_wildcard)) { + info->push_back(default_info); + if (actual_mime_types) + actual_mime_types->push_back(mime_type); + } + } +} + bool PluginList::GetPluginInfo(const GURL& url, const std::string& mime_type, bool allow_wildcard, WebPluginInfo* info, std::string* actual_mime_type) { - bool found = FindPlugin(mime_type, allow_wildcard, info); - if (!found || (info->path.value() == kDefaultPluginLibraryName)) { - if (FindPlugin(url, actual_mime_type, info) || - FindDisabledPlugin(mime_type, allow_wildcard, info)) { - found = true; + DCHECK(info); + std::vector<WebPluginInfo> info_list; + + // GetPluginInfoArray has slightly less work to do if we can pass + // NULL for the mime type list... + if (actual_mime_type) { + std::vector<std::string> mime_type_list; + GetPluginInfoArray(url, mime_type, allow_wildcard, &info_list, &mime_type_list); + if (!info_list.empty()) { + *info = info_list[0]; + *actual_mime_type = mime_type_list[0]; + return true; + } + } else { + GetPluginInfoArray(url, mime_type, allow_wildcard, &info_list, NULL); + if (!info_list.empty()) { + *info = info_list[0]; + return true; } } - - return found; + return false; } bool PluginList::GetPluginInfoByPath(const FilePath& plugin_path, diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 2ab0b0a..25b903b 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -133,12 +133,24 @@ class PluginList { // Get all the enabled plugins. void GetEnabledPlugins(bool refresh, std::vector<WebPluginInfo>* plugins); - // Returns true if a plugin is found for the given url and mime type - // (including disabled plugins, for which |info->enabled| is false). - // The mime type which corresponds to the URL is optionally returned - // back. - // The allow_wildcard parameter controls whether this function returns - // plugins which support wildcard mime types (* as the mime type). + // Returns a list in |info| containing plugins that are found for + // the given url and mime type (including disabled plugins, for + // which |info->enabled| is false). The mime type which corresponds + // to the URL is optionally returned back in |actual_mime_types| (if + // it is non-NULL), one for each of the plugin info objects found. + // The |allow_wildcard| parameter controls whether this function + // returns plugins which support wildcard mime types (* as the mime + // type). The |info| parameter is required to be non-NULL. The + // list is in order of "most desirable" to "least desirable", + // meaning that the default plugin is at the end of the list. + void GetPluginInfoArray(const GURL& url, + const std::string& mime_type, + bool allow_wildcard, + std::vector<WebPluginInfo>* info, + std::vector<std::string>* actual_mime_types); + + // Returns the first item from the list returned in GetPluginInfo in |info|. + // Returns true if it found a match. |actual_mime_type| may be NULL. bool GetPluginInfo(const GURL& url, const std::string& mime_type, bool allow_wildcard, @@ -217,24 +229,6 @@ class PluginList { // list of disabled groups as well. bool ShouldDisableGroup(const string16& group_name); - // Find a plugin by mime type; only searches enabled plugins. - // The allow_wildcard parameter controls whether this function returns - // plugins which support wildcard mime types (* as the mime type) - bool FindPlugin(const std::string &mime_type, - bool allow_wildcard, - WebPluginInfo* info); - - // Just like |FindPlugin| but it only looks at the disabled plug-ins. - bool FindDisabledPlugin(const std::string &mime_type, - bool allow_wildcard, - WebPluginInfo* info); - - // Find a plugin by extension; only searches enabled plugins. Returns the - // corresponding mime type. - bool FindPlugin(const GURL &url, - std::string* actual_mime_type, - WebPluginInfo* info); - // Like GetPluginGroups above, but works on a given vector of plugins. static void GetPluginGroups(const std::vector<WebPluginInfo>* plugins, PluginMap* plugin_groups); diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index e9c516a..f0e3f85 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -256,9 +256,6 @@ WebPlugin* CreateWebPlugin(WebFrame* frame, return NULL; } - if (actual_mime_type.empty()) - actual_mime_type = params.mimeType.utf8(); - return new WebPluginImplWithPageDelegate( frame, params, info.path, actual_mime_type); } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 4fe8d69..41bf9d3 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -702,12 +702,8 @@ WebPlugin* TestWebViewDelegate::createPlugin( std::string actual_mime_type; if (!NPAPI::PluginList::Singleton()->GetPluginInfo( params.url, params.mimeType.utf8(), allow_wildcard, &info, - &actual_mime_type) || !info.enabled) { + &actual_mime_type) || !info.enabled) return NULL; - } - - if (actual_mime_type.empty()) - actual_mime_type = params.mimeType.utf8(); return new webkit_glue::WebPluginImpl( frame, params, info.path, actual_mime_type, AsWeakPtr()); |