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

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

Issue 2927703003: Move ObjectContentType entirely to HTMLPlugInElement (Closed)
Patch Set: More 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
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"
84 #include "platform/plugins/PluginData.h" 83 #include "platform/plugins/PluginData.h"
85 #include "platform/wtf/PtrUtil.h" 84 #include "platform/wtf/PtrUtil.h"
86 #include "platform/wtf/StringExtras.h" 85 #include "platform/wtf/StringExtras.h"
87 #include "platform/wtf/text/CString.h" 86 #include "platform/wtf/text/CString.h"
88 #include "platform/wtf/text/WTFString.h" 87 #include "platform/wtf/text/WTFString.h"
89 #include "public/platform/Platform.h" 88 #include "public/platform/Platform.h"
90 #include "public/platform/WebApplicationCacheHost.h" 89 #include "public/platform/WebApplicationCacheHost.h"
91 #include "public/platform/WebMediaPlayerSource.h" 90 #include "public/platform/WebMediaPlayerSource.h"
92 #include "public/platform/WebRTCPeerConnectionHandler.h" 91 #include "public/platform/WebRTCPeerConnectionHandler.h"
93 #include "public/platform/WebSecurityOrigin.h" 92 #include "public/platform/WebSecurityOrigin.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer( 804 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer(
806 source, client, &encrypted_media, 805 source, client, &encrypted_media,
807 encrypted_media.ContentDecryptionModule(), sink_id)); 806 encrypted_media.ContentDecryptionModule(), sink_id));
808 } 807 }
809 808
810 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient( 809 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient(
811 HTMLMediaElement& html_media_element) { 810 HTMLMediaElement& html_media_element) {
812 return HTMLMediaElementRemotePlayback::remote(html_media_element); 811 return HTMLMediaElementRemotePlayback::remote(html_media_element);
813 } 812 }
814 813
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
856 WebCookieJar* LocalFrameClientImpl::CookieJar() const { 814 WebCookieJar* LocalFrameClientImpl::CookieJar() const {
857 if (!web_frame_->Client()) 815 if (!web_frame_->Client())
858 return 0; 816 return 0;
859 return web_frame_->Client()->CookieJar(); 817 return web_frame_->Client()->CookieJar();
860 } 818 }
861 819
862 void LocalFrameClientImpl::FrameFocused() const { 820 void LocalFrameClientImpl::FrameFocused() const {
863 if (web_frame_->Client()) 821 if (web_frame_->Client())
864 web_frame_->Client()->FrameFocused(); 822 web_frame_->Client()->FrameFocused();
865 } 823 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() { 1009 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() {
1052 return web_frame_->CreateURLLoader(); 1010 return web_frame_->CreateURLLoader();
1053 } 1011 }
1054 1012
1055 service_manager::InterfaceProvider* 1013 service_manager::InterfaceProvider*
1056 LocalFrameClientImpl::GetInterfaceProvider() { 1014 LocalFrameClientImpl::GetInterfaceProvider() {
1057 return web_frame_->Client()->GetInterfaceProvider(); 1015 return web_frame_->Client()->GetInterfaceProvider();
1058 } 1016 }
1059 1017
1060 } // namespace blink 1018 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698