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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 22572005: Remove all uses of the ASCIILiteral class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rm it from wtf Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/FormController.cpp ('k') | Source/core/html/ImageInputType.cpp » ('j') | 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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ASSERT(m_mediaElement); 181 ASSERT(m_mediaElement);
182 m_mediaElement->endIgnoringTrackDisplayUpdateRequests(); 182 m_mediaElement->endIgnoringTrackDisplayUpdateRequests();
183 } 183 }
184 184
185 private: 185 private:
186 HTMLMediaElement* m_mediaElement; 186 HTMLMediaElement* m_mediaElement;
187 }; 187 };
188 188
189 static bool canLoadURL(const KURL& url, const ContentType& contentType, const St ring& keySystem) 189 static bool canLoadURL(const KURL& url, const ContentType& contentType, const St ring& keySystem)
190 { 190 {
191 DEFINE_STATIC_LOCAL(const String, codecs, (ASCIILiteral("codecs"))); 191 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs"));
192 192
193 String contentMIMEType = contentType.type().lower(); 193 String contentMIMEType = contentType.type().lower();
194 String contentTypeCodecs = contentType.parameter(codecs); 194 String contentTypeCodecs = contentType.parameter(codecs);
195 195
196 // If the MIME type is missing or is not meaningful, try to figure it out fr om the URL. 196 // If the MIME type is missing or is not meaningful, try to figure it out fr om the URL.
197 if (contentMIMEType.isEmpty() || contentMIMEType == "application/octet-strea m" || contentMIMEType == "text/plain") { 197 if (contentMIMEType.isEmpty() || contentMIMEType == "application/octet-strea m" || contentMIMEType == "text/plain") {
198 if (url.protocolIsData()) 198 if (url.protocolIsData())
199 contentMIMEType = mimeTypeFromDataURL(url.string()); 199 contentMIMEType = mimeTypeFromDataURL(url.string());
200 } 200 }
201 201
202 // If no MIME type is specified, always attempt to load. 202 // If no MIME type is specified, always attempt to load.
203 if (contentMIMEType.isEmpty()) 203 if (contentMIMEType.isEmpty())
204 return true; 204 return true;
205 205
206 // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream" 206 // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
207 // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows 207 // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
208 // it cannot render. 208 // it cannot render.
209 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp ty()) { 209 if (contentMIMEType != "application/octet-stream" || contentTypeCodecs.isEmp ty()) {
210 WebMimeRegistry::SupportsType supported = WebKit::Platform::current()->m imeRegistry()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, keySyst em.lower()); 210 WebMimeRegistry::SupportsType supported = WebKit::Platform::current()->m imeRegistry()->supportsMediaMIMEType(contentMIMEType, contentTypeCodecs, keySyst em.lower());
211 return supported > WebMimeRegistry::IsNotSupported; 211 return supported > WebMimeRegistry::IsNotSupported;
212 } 212 }
213 213
214 return false; 214 return false;
215 } 215 }
216 216
217 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem) 217 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType& contentType, const String& keySystem)
218 { 218 {
219 DEFINE_STATIC_LOCAL(const String, codecs, (ASCIILiteral("codecs"))); 219 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs"));
220 220
221 if (!RuntimeEnabledFeatures::mediaEnabled()) 221 if (!RuntimeEnabledFeatures::mediaEnabled())
222 return WebMimeRegistry::IsNotSupported; 222 return WebMimeRegistry::IsNotSupported;
223 223
224 String type = contentType.type().lower(); 224 String type = contentType.type().lower();
225 // The codecs string is not lower-cased because MP4 values are case sensitiv e 225 // The codecs string is not lower-cased because MP4 values are case sensitiv e
226 // per http://tools.ietf.org/html/rfc4281#page-7. 226 // per http://tools.ietf.org/html/rfc4281#page-7.
227 String typeCodecs = contentType.parameter(codecs); 227 String typeCodecs = contentType.parameter(codecs);
228 String system = keySystem.lower(); 228 String system = keySystem.lower();
229 229
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType), keySystem); 613 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType), keySystem);
614 String canPlay; 614 String canPlay;
615 615
616 // 4.8.10.3 616 // 4.8.10.3
617 switch (support) 617 switch (support)
618 { 618 {
619 case WebMimeRegistry::IsNotSupported: 619 case WebMimeRegistry::IsNotSupported:
620 canPlay = emptyString(); 620 canPlay = emptyString();
621 break; 621 break;
622 case WebMimeRegistry::MayBeSupported: 622 case WebMimeRegistry::MayBeSupported:
623 canPlay = ASCIILiteral("maybe"); 623 canPlay = "maybe";
624 break; 624 break;
625 case WebMimeRegistry::IsSupported: 625 case WebMimeRegistry::IsSupported:
626 canPlay = ASCIILiteral("probably"); 626 canPlay = "probably";
627 break; 627 break;
628 } 628 }
629 629
630 LOG(Media, "HTMLMediaElement::canPlayType(%s, %s, %s) -> %s", mimeType.utf8( ).data(), keySystem.utf8().data(), url.elidedString().utf8().data(), canPlay.utf 8().data()); 630 LOG(Media, "HTMLMediaElement::canPlayType(%s, %s, %s) -> %s", mimeType.utf8( ).data(), keySystem.utf8().data(), url.elidedString().utf8().data(), canPlay.utf 8().data());
631 631
632 return canPlay; 632 return canPlay;
633 } 633 }
634 634
635 void HTMLMediaElement::load() 635 void HTMLMediaElement::load()
636 { 636 {
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 void HTMLMediaElement::setAutoplay(bool b) 2119 void HTMLMediaElement::setAutoplay(bool b)
2120 { 2120 {
2121 LOG(Media, "HTMLMediaElement::setAutoplay(%s)", boolString(b)); 2121 LOG(Media, "HTMLMediaElement::setAutoplay(%s)", boolString(b));
2122 setBooleanAttribute(autoplayAttr, b); 2122 setBooleanAttribute(autoplayAttr, b);
2123 } 2123 }
2124 2124
2125 String HTMLMediaElement::preload() const 2125 String HTMLMediaElement::preload() const
2126 { 2126 {
2127 switch (m_preload) { 2127 switch (m_preload) {
2128 case MediaPlayer::None: 2128 case MediaPlayer::None:
2129 return ASCIILiteral("none"); 2129 return "none";
2130 break; 2130 break;
2131 case MediaPlayer::MetaData: 2131 case MediaPlayer::MetaData:
2132 return ASCIILiteral("metadata"); 2132 return "metadata";
2133 break; 2133 break;
2134 case MediaPlayer::Auto: 2134 case MediaPlayer::Auto:
2135 return ASCIILiteral("auto"); 2135 return "auto";
2136 break; 2136 break;
2137 } 2137 }
2138 2138
2139 ASSERT_NOT_REACHED(); 2139 ASSERT_NOT_REACHED();
2140 return String(); 2140 return String();
2141 } 2141 }
2142 2142
2143 void HTMLMediaElement::setPreload(const String& preload) 2143 void HTMLMediaElement::setPreload(const String& preload)
2144 { 2144 {
2145 LOG(Media, "HTMLMediaElement::setPreload(%s)", preload.utf8().data()); 2145 LOG(Media, "HTMLMediaElement::setPreload(%s)", preload.utf8().data());
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
3973 { 3973 {
3974 m_restrictions = NoRestrictions; 3974 m_restrictions = NoRestrictions;
3975 } 3975 }
3976 3976
3977 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() 3977 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate()
3978 { 3978 {
3979 scheduleLayerUpdate(); 3979 scheduleLayerUpdate();
3980 } 3980 }
3981 3981
3982 } 3982 }
OLDNEW
« no previous file with comments | « Source/core/html/FormController.cpp ('k') | Source/core/html/ImageInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698