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

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

Issue 2949873005: 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/WebFrameScheduler.h" 78 #include "platform/WebFrameScheduler.h"
79 #include "platform/exported/WrappedResourceRequest.h" 79 #include "platform/exported/WrappedResourceRequest.h"
80 #include "platform/exported/WrappedResourceResponse.h" 80 #include "platform/exported/WrappedResourceResponse.h"
81 #include "platform/feature_policy/FeaturePolicy.h" 81 #include "platform/feature_policy/FeaturePolicy.h"
82 #include "platform/loader/fetch/ResourceFetcher.h" 82 #include "platform/loader/fetch/ResourceFetcher.h"
83 #include "platform/network/HTTPParsers.h" 83 #include "platform/network/HTTPParsers.h"
84 #include "platform/network/mime/MIMETypeRegistry.h"
85 #include "platform/plugins/PluginData.h" 84 #include "platform/plugins/PluginData.h"
86 #include "platform/wtf/PtrUtil.h" 85 #include "platform/wtf/PtrUtil.h"
87 #include "platform/wtf/StringExtras.h" 86 #include "platform/wtf/StringExtras.h"
88 #include "platform/wtf/text/CString.h" 87 #include "platform/wtf/text/CString.h"
89 #include "platform/wtf/text/WTFString.h" 88 #include "platform/wtf/text/WTFString.h"
90 #include "public/platform/Platform.h" 89 #include "public/platform/Platform.h"
91 #include "public/platform/WebApplicationCacheHost.h" 90 #include "public/platform/WebApplicationCacheHost.h"
92 #include "public/platform/WebMediaPlayerSource.h" 91 #include "public/platform/WebMediaPlayerSource.h"
93 #include "public/platform/WebRTCPeerConnectionHandler.h" 92 #include "public/platform/WebRTCPeerConnectionHandler.h"
94 #include "public/platform/WebSecurityOrigin.h" 93 #include "public/platform/WebSecurityOrigin.h"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer( 844 return WTF::WrapUnique(web_frame->Client()->CreateMediaPlayer(
846 source, client, &encrypted_media, 845 source, client, &encrypted_media,
847 encrypted_media.ContentDecryptionModule(), sink_id)); 846 encrypted_media.ContentDecryptionModule(), sink_id));
848 } 847 }
849 848
850 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient( 849 WebRemotePlaybackClient* LocalFrameClientImpl::CreateWebRemotePlaybackClient(
851 HTMLMediaElement& html_media_element) { 850 HTMLMediaElement& html_media_element) {
852 return HTMLMediaElementRemotePlayback::remote(html_media_element); 851 return HTMLMediaElementRemotePlayback::remote(html_media_element);
853 } 852 }
854 853
855 ObjectContentType LocalFrameClientImpl::GetObjectContentType(
856 const KURL& url,
857 const String& explicit_mime_type,
858 bool should_prefer_plug_ins_for_images) {
859 // This code is based on Apple's implementation from
860 // WebCoreSupport/WebFrameBridge.mm.
861
862 String mime_type = explicit_mime_type;
863 if (mime_type.IsEmpty()) {
864 // Try to guess the MIME type based off the extension.
865 String filename = url.LastPathComponent();
866 int extension_pos = filename.ReverseFind('.');
867 if (extension_pos >= 0) {
868 String extension = filename.Substring(extension_pos + 1);
869 mime_type = MIMETypeRegistry::GetWellKnownMIMETypeForExtension(extension);
870 }
871
872 if (mime_type.IsEmpty())
873 return kObjectContentFrame;
874 }
875
876 // If Chrome is started with the --disable-plugins switch, pluginData is 0.
877 PluginData* plugin_data = web_frame_->GetFrame()->GetPluginData();
878 bool plug_in_supports_mime_type =
879 plugin_data && plugin_data->SupportsMimeType(mime_type);
880
881 if (MIMETypeRegistry::IsSupportedImageMIMEType(mime_type)) {
882 return should_prefer_plug_ins_for_images && plug_in_supports_mime_type
883 ? kObjectContentNetscapePlugin
884 : kObjectContentImage;
885 }
886
887 if (plug_in_supports_mime_type)
888 return kObjectContentNetscapePlugin;
889
890 if (MIMETypeRegistry::IsSupportedNonImageMIMEType(mime_type))
891 return kObjectContentFrame;
892
893 return kObjectContentNone;
894 }
895
896 WebCookieJar* LocalFrameClientImpl::CookieJar() const { 854 WebCookieJar* LocalFrameClientImpl::CookieJar() const {
897 if (!web_frame_->Client()) 855 if (!web_frame_->Client())
898 return 0; 856 return 0;
899 return web_frame_->Client()->CookieJar(); 857 return web_frame_->Client()->CookieJar();
900 } 858 }
901 859
902 void LocalFrameClientImpl::FrameFocused() const { 860 void LocalFrameClientImpl::FrameFocused() const {
903 if (web_frame_->Client()) 861 if (web_frame_->Client())
904 web_frame_->Client()->FrameFocused(); 862 web_frame_->Client()->FrameFocused();
905 } 863 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 service_manager::InterfaceProvider* 1064 service_manager::InterfaceProvider*
1107 LocalFrameClientImpl::GetInterfaceProvider() { 1065 LocalFrameClientImpl::GetInterfaceProvider() {
1108 return web_frame_->Client()->GetInterfaceProvider(); 1066 return web_frame_->Client()->GetInterfaceProvider();
1109 } 1067 }
1110 1068
1111 void LocalFrameClientImpl::AnnotatedRegionsChanged() { 1069 void LocalFrameClientImpl::AnnotatedRegionsChanged() {
1112 web_frame_->Client()->DraggableRegionsChanged(); 1070 web_frame_->Client()->DraggableRegionsChanged();
1113 } 1071 }
1114 1072
1115 } // namespace blink 1073 } // 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