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) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // a LayoutEmbeddedObject or LayoutPart. | 253 // a LayoutEmbeddedObject or LayoutPart. |
254 if (useFallbackContent()) | 254 if (useFallbackContent()) |
255 return LayoutObject::createObject(this, style); | 255 return LayoutObject::createObject(this, style); |
256 | 256 |
257 if (isImageType()) { | 257 if (isImageType()) { |
258 LayoutImage* image = new LayoutImage(this); | 258 LayoutImage* image = new LayoutImage(this); |
259 image->setImageResource(LayoutImageResource::create()); | 259 image->setImageResource(LayoutImageResource::create()); |
260 return image; | 260 return image; |
261 } | 261 } |
262 | 262 |
263 | 263 m_pluginIsAvailable = true; |
264 return new LayoutEmbeddedObject(this); | 264 return new LayoutEmbeddedObject(this); |
265 } | 265 } |
266 | 266 |
267 void HTMLPlugInElement::finishParsingChildren() | 267 void HTMLPlugInElement::finishParsingChildren() |
268 { | 268 { |
269 HTMLFrameOwnerElement::finishParsingChildren(); | 269 HTMLFrameOwnerElement::finishParsingChildren(); |
270 if (useFallbackContent()) | 270 if (useFallbackContent()) |
271 return; | 271 return; |
272 | 272 |
273 setNeedsWidgetUpdate(true); | 273 setNeedsWidgetUpdate(true); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return true; | 390 return true; |
391 } | 391 } |
392 | 392 |
393 bool HTMLPlugInElement::layoutObjectIsFocusable() const | 393 bool HTMLPlugInElement::layoutObjectIsFocusable() const |
394 { | 394 { |
395 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::layoutO
bjectIsFocusable()) | 395 if (HTMLFrameOwnerElement::supportsFocus() && HTMLFrameOwnerElement::layoutO
bjectIsFocusable()) |
396 return true; | 396 return true; |
397 | 397 |
398 if (useFallbackContent() || !HTMLFrameOwnerElement::layoutObjectIsFocusable(
)) | 398 if (useFallbackContent() || !HTMLFrameOwnerElement::layoutObjectIsFocusable(
)) |
399 return false; | 399 return false; |
400 return layoutObject() && layoutObject()->isEmbeddedObject() && !layoutEmbedd
edItem().showsUnavailablePluginIndicator(); | 400 return m_pluginIsAvailable; |
401 } | 401 } |
402 | 402 |
403 bool HTMLPlugInElement::isImageType() | 403 bool HTMLPlugInElement::isImageType() |
404 { | 404 { |
405 if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) | 405 if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) |
406 m_serviceType = mimeTypeFromDataURL(m_url); | 406 m_serviceType = mimeTypeFromDataURL(m_url); |
407 | 407 |
408 if (LocalFrame* frame = document().frame()) { | 408 if (LocalFrame* frame = document().frame()) { |
409 KURL completedURL = document().completeURL(m_url); | 409 KURL completedURL = document().completeURL(m_url); |
410 return frame->loader().client()->getObjectContentType(completedURL, m_se
rviceType, shouldPreferPlugInsForImages()) == ObjectContentImage; | 410 return frame->loader().client()->getObjectContentType(completedURL, m_se
rviceType, shouldPreferPlugInsForImages()) == ObjectContentImage; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 VLOG(1) << "Loaded URL: " << url.getString(); | 486 VLOG(1) << "Loaded URL: " << url.getString(); |
487 m_loadedUrl = url; | 487 m_loadedUrl = url; |
488 | 488 |
489 if (m_persistedPluginWidget) { | 489 if (m_persistedPluginWidget) { |
490 setWidget(m_persistedPluginWidget.release()); | 490 setWidget(m_persistedPluginWidget.release()); |
491 } else { | 491 } else { |
492 bool loadManually = document().isPluginDocument() && !document().contain
sPlugins(); | 492 bool loadManually = document().isPluginDocument() && !document().contain
sPlugins(); |
493 FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? F
rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; | 493 FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? F
rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; |
494 Widget* widget = frame->loader().client()->createPlugin(this, url, param
Names, paramValues, mimeType, loadManually, policy); | 494 Widget* widget = frame->loader().client()->createPlugin(this, url, param
Names, paramValues, mimeType, loadManually, policy); |
495 if (!widget) { | 495 if (!widget) { |
496 if (!layoutItem.isNull() && !layoutItem.showsUnavailablePluginIndica
tor()) | 496 if (!layoutItem.isNull() && !layoutItem.showsUnavailablePluginIndica
tor()) { |
| 497 m_pluginIsAvailable = false; |
497 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::P
luginMissing); | 498 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::P
luginMissing); |
| 499 } |
498 return false; | 500 return false; |
499 } | 501 } |
500 | 502 |
501 if (!layoutItem.isNull()) | 503 if (!layoutItem.isNull()) |
502 setWidget(widget); | 504 setWidget(widget); |
503 else | 505 else |
504 setPersistedPluginWidget(widget); | 506 setPersistedPluginWidget(widget); |
505 } | 507 } |
506 | 508 |
507 document().setContainsPlugins(); | 509 document().setContainsPlugins(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (!document().getSecurityOrigin()->canDisplay(url)) { | 550 if (!document().getSecurityOrigin()->canDisplay(url)) { |
549 FrameLoader::reportLocalLoadFailed(frame, url.getString()); | 551 FrameLoader::reportLocalLoadFailed(frame, url.getString()); |
550 return false; | 552 return false; |
551 } | 553 } |
552 | 554 |
553 AtomicString declaredMimeType = document().isPluginDocument() && document().
localOwner() ? | 555 AtomicString declaredMimeType = document().isPluginDocument() && document().
localOwner() ? |
554 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) : | 556 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) : |
555 fastGetAttribute(HTMLNames::typeAttr); | 557 fastGetAttribute(HTMLNames::typeAttr); |
556 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) | 558 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) |
557 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), mimeType, declaredMimeType, url)) { | 559 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum
ent(), mimeType, declaredMimeType, url)) { |
558 if (LayoutEmbeddedItem layoutItem = layoutEmbeddedItem()) | 560 if (LayoutEmbeddedItem layoutItem = layoutEmbeddedItem()) { |
| 561 m_pluginIsAvailable = false; |
559 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::Plugi
nBlockedByContentSecurityPolicy); | 562 layoutItem.setPluginUnavailabilityReason(LayoutEmbeddedObject::Plugi
nBlockedByContentSecurityPolicy); |
| 563 } |
560 return false; | 564 return false; |
561 } | 565 } |
562 // If the URL is empty, a plugin could still be instantiated if a MIME-type | 566 // If the URL is empty, a plugin could still be instantiated if a MIME-type |
563 // is specified. | 567 // is specified. |
564 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul
dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType
None, ResourceRequest::RedirectStatus::NoRedirect, url); | 568 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul
dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType
None, ResourceRequest::RedirectStatus::NoRedirect, url); |
565 } | 569 } |
566 | 570 |
567 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT
ype) | 571 bool HTMLPlugInElement::allowedToLoadPlugin(const KURL& url, const String& mimeT
ype) |
568 { | 572 { |
569 if (document().isSandboxed(SandboxPlugins)) { | 573 if (document().isSandboxed(SandboxPlugins)) { |
(...skipping 21 matching lines...) Expand all Loading... |
591 | 595 |
592 void HTMLPlugInElement::lazyReattachIfNeeded() | 596 void HTMLPlugInElement::lazyReattachIfNeeded() |
593 { | 597 { |
594 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma
geType()) { | 598 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma
geType()) { |
595 lazyReattachIfAttached(); | 599 lazyReattachIfAttached(); |
596 setPersistedPluginWidget(nullptr); | 600 setPersistedPluginWidget(nullptr); |
597 } | 601 } |
598 } | 602 } |
599 | 603 |
600 } // namespace blink | 604 } // namespace blink |
OLD | NEW |