| Index: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
|
| index 13762c2b8d53c933aee41d0dd41a84c962e0c338..7750470f391c4437e9306484f8c90d1fd2875188 100644
|
| --- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
|
| @@ -80,6 +80,7 @@
|
| #include "platform/feature_policy/FeaturePolicy.h"
|
| #include "platform/loader/fetch/ResourceFetcher.h"
|
| #include "platform/network/HTTPParsers.h"
|
| +#include "platform/network/mime/MIMETypeRegistry.h"
|
| #include "platform/plugins/PluginData.h"
|
| #include "platform/wtf/PtrUtil.h"
|
| #include "platform/wtf/StringExtras.h"
|
| @@ -811,6 +812,47 @@
|
| return HTMLMediaElementRemotePlayback::remote(html_media_element);
|
| }
|
|
|
| +ObjectContentType LocalFrameClientImpl::GetObjectContentType(
|
| + const KURL& url,
|
| + const String& explicit_mime_type,
|
| + bool should_prefer_plug_ins_for_images) {
|
| + // This code is based on Apple's implementation from
|
| + // WebCoreSupport/WebFrameBridge.mm.
|
| +
|
| + String mime_type = explicit_mime_type;
|
| + if (mime_type.IsEmpty()) {
|
| + // Try to guess the MIME type based off the extension.
|
| + String filename = url.LastPathComponent();
|
| + int extension_pos = filename.ReverseFind('.');
|
| + if (extension_pos >= 0) {
|
| + String extension = filename.Substring(extension_pos + 1);
|
| + mime_type = MIMETypeRegistry::GetWellKnownMIMETypeForExtension(extension);
|
| + }
|
| +
|
| + if (mime_type.IsEmpty())
|
| + return kObjectContentFrame;
|
| + }
|
| +
|
| + // If Chrome is started with the --disable-plugins switch, pluginData is 0.
|
| + PluginData* plugin_data = web_frame_->GetFrame()->GetPluginData();
|
| + bool plug_in_supports_mime_type =
|
| + plugin_data && plugin_data->SupportsMimeType(mime_type);
|
| +
|
| + if (MIMETypeRegistry::IsSupportedImageMIMEType(mime_type)) {
|
| + return should_prefer_plug_ins_for_images && plug_in_supports_mime_type
|
| + ? kObjectContentNetscapePlugin
|
| + : kObjectContentImage;
|
| + }
|
| +
|
| + if (plug_in_supports_mime_type)
|
| + return kObjectContentNetscapePlugin;
|
| +
|
| + if (MIMETypeRegistry::IsSupportedNonImageMIMEType(mime_type))
|
| + return kObjectContentFrame;
|
| +
|
| + return kObjectContentNone;
|
| +}
|
| +
|
| WebCookieJar* LocalFrameClientImpl::CookieJar() const {
|
| if (!web_frame_->Client())
|
| return 0;
|
|
|