OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 if (inViewSourceMode) | 324 if (inViewSourceMode) |
325 return HTMLViewSourceDocument::create(DocumentInit(url, frame), type); | 325 return HTMLViewSourceDocument::create(DocumentInit(url, frame), type); |
326 | 326 |
327 // Plugins cannot take HTML and XHTML from us, and we don't even need to ini
tialize the plugin database for those. | 327 // Plugins cannot take HTML and XHTML from us, and we don't even need to ini
tialize the plugin database for those. |
328 if (type == "text/html") | 328 if (type == "text/html") |
329 return HTMLDocument::create(DocumentInit(url, frame)); | 329 return HTMLDocument::create(DocumentInit(url, frame)); |
330 if (type == "application/xhtml+xml") | 330 if (type == "application/xhtml+xml") |
331 return Document::createXHTML(DocumentInit(url, frame)); | 331 return Document::createXHTML(DocumentInit(url, frame)); |
332 | 332 |
333 PluginData* pluginData = 0; | 333 PluginData* pluginData = 0; |
334 if (frame && frame->page() && frame->loader()->allowPlugins(NotAboutToInstan
tiatePlugin)) | 334 if (frame && frame->page() && frame->loader().allowPlugins(NotAboutToInstant
iatePlugin)) |
335 pluginData = frame->page()->pluginData(); | 335 pluginData = frame->page()->pluginData(); |
336 | 336 |
337 // PDF is one image type for which a plugin can override built-in support. | 337 // PDF is one image type for which a plugin can override built-in support. |
338 // We do not want QuickTime to take over all image types, obviously. | 338 // We do not want QuickTime to take over all image types, obviously. |
339 if ((type == "application/pdf" || type == "text/pdf") && pluginData && plugi
nData->supportsMimeType(type)) | 339 if ((type == "application/pdf" || type == "text/pdf") && pluginData && plugi
nData->supportsMimeType(type)) |
340 return PluginDocument::create(DocumentInit(url, frame)); | 340 return PluginDocument::create(DocumentInit(url, frame)); |
341 if (Image::supportsType(type)) | 341 if (Image::supportsType(type)) |
342 return ImageDocument::create(DocumentInit(url, frame)); | 342 return ImageDocument::create(DocumentInit(url, frame)); |
343 | 343 |
344 // Check to see if the type can be played by our MediaPlayer, if so create a
MediaDocument | 344 // Check to see if the type can be played by our MediaPlayer, if so create a
MediaDocument |
345 if (HTMLMediaElement::supportsType(ContentType(type))) | 345 if (HTMLMediaElement::supportsType(ContentType(type))) |
346 return MediaDocument::create(DocumentInit(url, frame)); | 346 return MediaDocument::create(DocumentInit(url, frame)); |
347 | 347 |
348 // Everything else except text/plain can be overridden by plugins. In partic
ular, Adobe SVG Viewer should be used for SVG, if installed. | 348 // Everything else except text/plain can be overridden by plugins. In partic
ular, Adobe SVG Viewer should be used for SVG, if installed. |
349 // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a
fundamental type that the browser is expected to handle, | 349 // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a
fundamental type that the browser is expected to handle, |
350 // and also serves as an optimization to prevent loading the plug-in databas
e in the common case. | 350 // and also serves as an optimization to prevent loading the plug-in databas
e in the common case. |
351 if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type)
) | 351 if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type)
) |
352 return PluginDocument::create(DocumentInit(url, frame)); | 352 return PluginDocument::create(DocumentInit(url, frame)); |
353 if (isTextMIMEType(type)) | 353 if (isTextMIMEType(type)) |
354 return TextDocument::create(DocumentInit(url, frame)); | 354 return TextDocument::create(DocumentInit(url, frame)); |
355 if (type == "image/svg+xml") | 355 if (type == "image/svg+xml") |
356 return SVGDocument::create(DocumentInit(url, frame)); | 356 return SVGDocument::create(DocumentInit(url, frame)); |
357 if (isXMLMIMEType(type)) | 357 if (isXMLMIMEType(type)) |
358 return Document::create(DocumentInit(url, frame)); | 358 return Document::create(DocumentInit(url, frame)); |
359 | 359 |
360 return HTMLDocument::create(DocumentInit(url, frame)); | 360 return HTMLDocument::create(DocumentInit(url, frame)); |
361 } | 361 } |
362 | 362 |
363 } | 363 } |
OLD | NEW |