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

Side by Side Diff: net/base/mime_sniffer.cc

Issue 15875004: Add more RAW picture formats to the media galleries extension filter. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add phase one raw files Created 7 years, 7 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 | « chrome/browser/media_galleries/fileapi/media_path_filter.cc ('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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Detecting mime types is a tricky business because we need to balance 5 // Detecting mime types is a tricky business because we need to balance
6 // compatibility concerns with security issues. Here is a survey of how other 6 // compatibility concerns with security issues. Here is a survey of how other
7 // browsers behave and then a description of how we intend to behave. 7 // browsers behave and then a description of how we intend to behave.
8 // 8 //
9 // HTML payload, no Content-Type header: 9 // HTML payload, no Content-Type header:
10 // * IE 7: Render as HTML 10 // * IE 7: Render as HTML
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 MAGIC_NUMBER("audio/ogg", "OggS") 233 MAGIC_NUMBER("audio/ogg", "OggS")
234 MAGIC_MASK("video/mpeg", "\x00\x00\x01\xB0", "\xFF\xFF\xFF\xF0") 234 MAGIC_MASK("video/mpeg", "\x00\x00\x01\xB0", "\xFF\xFF\xFF\xF0")
235 MAGIC_MASK("audio/mpeg", "\xFF\xE0", "\xFF\xE0") 235 MAGIC_MASK("audio/mpeg", "\xFF\xE0", "\xFF\xE0")
236 MAGIC_NUMBER("video/3gpp", "....ftyp3g") 236 MAGIC_NUMBER("video/3gpp", "....ftyp3g")
237 MAGIC_NUMBER("video/3gpp", "....ftypavcl") 237 MAGIC_NUMBER("video/3gpp", "....ftypavcl")
238 MAGIC_NUMBER("video/mp4", "....ftyp") 238 MAGIC_NUMBER("video/mp4", "....ftyp")
239 MAGIC_NUMBER("video/quicktime", "MOVI") 239 MAGIC_NUMBER("video/quicktime", "MOVI")
240 MAGIC_NUMBER("application/x-shockwave-flash", "CWS") 240 MAGIC_NUMBER("application/x-shockwave-flash", "CWS")
241 MAGIC_NUMBER("application/x-shockwave-flash", "FWS") 241 MAGIC_NUMBER("application/x-shockwave-flash", "FWS")
242 MAGIC_NUMBER("video/x-flv", "FLV") 242 MAGIC_NUMBER("video/x-flv", "FLV")
243
244 // RAW image types.
245 MAGIC_NUMBER("image/x-canon-cr2", "II\x2a\x00\x10\x00\x00\x00CR")
246 MAGIC_NUMBER("image/x-canon-crw", "II\x1a\x00\x00\x00HEAPCCDR")
247 MAGIC_NUMBER("image/x-minolta-mrw", "\x00MRM")
248 MAGIC_NUMBER("image/x-olympus-orf", "MMOR") // big-endian
249 MAGIC_NUMBER("image/x-olympus-orf", "IIRO") // little-endian
250 MAGIC_NUMBER("image/x-olympus-orf", "IIRS") // little-endian
251 MAGIC_NUMBER("image/x-fuji-raf", "FUJIFILMCCD-RAW ")
252 MAGIC_NUMBER("image/x-panasonic-raw",
253 "IIU\x00\x08\x00\x00\x00") // Panasonic .raw
254 MAGIC_NUMBER("image/x-panasonic-raw",
255 "IIU\x00\x18\x00\x00\x00") // Panasonic .rw2
256 MAGIC_NUMBER("image/x-phaseone-raw", "MMMMRaw")
257 MAGIC_NUMBER("image/x-x3f", "FOVb")
243 }; 258 };
244 259
245 // Our HTML sniffer differs slightly from Mozilla. For example, Mozilla will 260 // Our HTML sniffer differs slightly from Mozilla. For example, Mozilla will
246 // decide that a document that begins "<!DOCTYPE SOAP-ENV:Envelope PUBLIC " is 261 // decide that a document that begins "<!DOCTYPE SOAP-ENV:Envelope PUBLIC " is
247 // HTML, but we will not. 262 // HTML, but we will not.
248 263
249 #define MAGIC_HTML_TAG(tag) \ 264 #define MAGIC_HTML_TAG(tag) \
250 MAGIC_STRING("text/html", "<" tag) 265 MAGIC_STRING("text/html", "<" tag)
251 266
252 static const MagicNumber kSniffableTags[] = { 267 static const MagicNumber kSniffableTags[] = {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 // First check the extra table. 958 // First check the extra table.
944 if (CheckForMagicNumbers(content, size, kExtraMagicNumbers, 959 if (CheckForMagicNumbers(content, size, kExtraMagicNumbers,
945 arraysize(kExtraMagicNumbers), NULL, result)) 960 arraysize(kExtraMagicNumbers), NULL, result))
946 return true; 961 return true;
947 // Finally check the original table. 962 // Finally check the original table.
948 return CheckForMagicNumbers(content, size, kMagicNumbers, 963 return CheckForMagicNumbers(content, size, kMagicNumbers,
949 arraysize(kMagicNumbers), NULL, result); 964 arraysize(kMagicNumbers), NULL, result);
950 } 965 }
951 966
952 } // namespace net 967 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/media_path_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698