Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp

Issue 2933213002: Revert of Move ObjectContentType entirely to HTMLPlugInElement (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "modules/serviceworkers/ServiceWorkerLinkResource.h" 73 #include "modules/serviceworkers/ServiceWorkerLinkResource.h"
74 #include "modules/storage/DOMWindowStorageController.h" 74 #include "modules/storage/DOMWindowStorageController.h"
75 #include "modules/vr/NavigatorVR.h" 75 #include "modules/vr/NavigatorVR.h"
76 #include "platform/Histogram.h" 76 #include "platform/Histogram.h"
77 #include "platform/RuntimeEnabledFeatures.h" 77 #include "platform/RuntimeEnabledFeatures.h"
78 #include "platform/exported/WrappedResourceRequest.h" 78 #include "platform/exported/WrappedResourceRequest.h"
79 #include "platform/exported/WrappedResourceResponse.h" 79 #include "platform/exported/WrappedResourceResponse.h"
80 #include "platform/feature_policy/FeaturePolicy.h" 80 #include "platform/feature_policy/FeaturePolicy.h"
81 #include "platform/loader/fetch/ResourceFetcher.h" 81 #include "platform/loader/fetch/ResourceFetcher.h"
82 #include "platform/network/HTTPParsers.h" 82 #include "platform/network/HTTPParsers.h"
83 #include "platform/network/mime/MIMETypeRegistry.h"
83 #include "platform/plugins/PluginData.h" 84 #include "platform/plugins/PluginData.h"
84 #include "platform/wtf/PtrUtil.h" 85 #include "platform/wtf/PtrUtil.h"
85 #include "platform/wtf/StringExtras.h" 86 #include "platform/wtf/StringExtras.h"
86 #include "platform/wtf/text/CString.h" 87 #include "platform/wtf/text/CString.h"
87 #include "platform/wtf/text/WTFString.h" 88 #include "platform/wtf/text/WTFString.h"
88 #include "public/platform/Platform.h" 89 #include "public/platform/Platform.h"
89 #include "public/platform/WebApplicationCacheHost.h" 90 #include "public/platform/WebApplicationCacheHost.h"
90 #include "public/platform/WebMediaPlayerSource.h" 91 #include "public/platform/WebMediaPlayerSource.h"
91 #include "public/platform/WebRTCPeerConnectionHandler.h" 92 #include "public/platform/WebRTCPeerConnectionHandler.h"
92 #include "public/platform/WebSecurityOrigin.h" 93 #include "public/platform/WebSecurityOrigin.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer( 805 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer(
805 source, client, &encrypted_media, 806 source, client, &encrypted_media,
806 encrypted_media.ContentDecryptionModule(), sink_id)); 807 encrypted_media.ContentDecryptionModule(), sink_id));
807 } 808 }
808 809
809 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient( 810 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient(
810 HTMLMediaElement& html_media_element) { 811 HTMLMediaElement& html_media_element) {
811 return HTMLMediaElementRemotePlayback::remote(html_media_element); 812 return HTMLMediaElementRemotePlayback::remote(html_media_element);
812 } 813 }
813 814
815 ObjectContentType LocalFrameClientImpl::GetObjectContentType(
816 const KURL& url,
817 const String& explicit_mime_type,
818 bool should_prefer_plug_ins_for_images) {
819 // This code is based on Apple's implementation from
820 // WebCoreSupport/WebFrameBridge.mm.
821
822 String mime_type = explicit_mime_type;
823 if (mime_type.IsEmpty()) {
824 // Try to guess the MIME type based off the extension.
825 String filename = url.LastPathComponent();
826 int extension_pos = filename.ReverseFind('.');
827 if (extension_pos >= 0) {
828 String extension = filename.Substring(extension_pos + 1);
829 mime_type = MIMETypeRegistry::GetWellKnownMIMETypeForExtension(extension);
830 }
831
832 if (mime_type.IsEmpty())
833 return kObjectContentFrame;
834 }
835
836 // If Chrome is started with the --disable-plugins switch, pluginData is 0.
837 PluginData* plugin_data = web_frame_->GetFrame()->GetPluginData();
838 bool plug_in_supports_mime_type =
839 plugin_data && plugin_data->SupportsMimeType(mime_type);
840
841 if (MIMETypeRegistry::IsSupportedImageMIMEType(mime_type)) {
842 return should_prefer_plug_ins_for_images && plug_in_supports_mime_type
843 ? kObjectContentNetscapePlugin
844 : kObjectContentImage;
845 }
846
847 if (plug_in_supports_mime_type)
848 return kObjectContentNetscapePlugin;
849
850 if (MIMETypeRegistry::IsSupportedNonImageMIMEType(mime_type))
851 return kObjectContentFrame;
852
853 return kObjectContentNone;
854 }
855
814 WebCookieJar* LocalFrameClientImpl::CookieJar() const { 856 WebCookieJar* LocalFrameClientImpl::CookieJar() const {
815 if (!web_frame_->Client()) 857 if (!web_frame_->Client())
816 return 0; 858 return 0;
817 return web_frame_->Client()->CookieJar(); 859 return web_frame_->Client()->CookieJar();
818 } 860 }
819 861
820 void LocalFrameClientImpl::FrameFocused() const { 862 void LocalFrameClientImpl::FrameFocused() const {
821 if (web_frame_->Client()) 863 if (web_frame_->Client())
822 web_frame_->Client()->FrameFocused(); 864 web_frame_->Client()->FrameFocused();
823 } 865 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() { 1051 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() {
1010 return web_frame_->CreateURLLoader(); 1052 return web_frame_->CreateURLLoader();
1011 } 1053 }
1012 1054
1013 service_manager::InterfaceProvider* 1055 service_manager::InterfaceProvider*
1014 LocalFrameClientImpl::GetInterfaceProvider() { 1056 LocalFrameClientImpl::GetInterfaceProvider() {
1015 return web_frame_->Client()->GetInterfaceProvider(); 1057 return web_frame_->Client()->GetInterfaceProvider();
1016 } 1058 }
1017 1059
1018 } // namespace blink 1060 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698