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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp

Issue 1942623002: Rename Document::ownerElement to localOwner and fix main frame checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed const changes and some gratuitous checks Created 4 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
OLDNEW
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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 ObjectContentType objectType = document().frame()->loader().client()->getObj ectContentType(url, mimeType, shouldPreferPlugInsForImages()); 527 ObjectContentType objectType = document().frame()->loader().client()->getObj ectContentType(url, mimeType, shouldPreferPlugInsForImages());
528 // If an object's content can't be handled and it has no fallback, let 528 // If an object's content can't be handled and it has no fallback, let
529 // it be handled as a plugin to show the broken plugin icon. 529 // it be handled as a plugin to show the broken plugin icon.
530 useFallback = objectType == ObjectContentNone && hasFallback; 530 useFallback = objectType == ObjectContentNone && hasFallback;
531 return objectType == ObjectContentNone || objectType == ObjectContentNetscap ePlugin; 531 return objectType == ObjectContentNone || objectType == ObjectContentNetscap ePlugin;
532 532
533 } 533 }
534 534
535 void HTMLPlugInElement::dispatchErrorEvent() 535 void HTMLPlugInElement::dispatchErrorEvent()
536 { 536 {
537 if (document().isPluginDocument() && document().ownerElement()) 537 if (document().isPluginDocument() && document().localOwner())
538 document().ownerElement()->dispatchEvent(Event::create(EventTypeNames::e rror)); 538 document().localOwner()->dispatchEvent(Event::create(EventTypeNames::err or));
539 else 539 else
540 dispatchEvent(Event::create(EventTypeNames::error)); 540 dispatchEvent(Event::create(EventTypeNames::error));
541 } 541 }
542 542
543 bool HTMLPlugInElement::allowedToLoadObject(const KURL& url, const String& mimeT ype) 543 bool HTMLPlugInElement::allowedToLoadObject(const KURL& url, const String& mimeT ype)
544 { 544 {
545 if (url.isEmpty() && mimeType.isEmpty()) 545 if (url.isEmpty() && mimeType.isEmpty())
546 return false; 546 return false;
547 547
548 LocalFrame* frame = document().frame(); 548 LocalFrame* frame = document().frame();
549 Settings* settings = frame->settings(); 549 Settings* settings = frame->settings();
550 if (!settings) 550 if (!settings)
551 return false; 551 return false;
552 552
553 if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) 553 if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType))
554 return false; 554 return false;
555 555
556 if (!document().getSecurityOrigin()->canDisplay(url)) { 556 if (!document().getSecurityOrigin()->canDisplay(url)) {
557 FrameLoader::reportLocalLoadFailed(frame, url.getString()); 557 FrameLoader::reportLocalLoadFailed(frame, url.getString());
558 return false; 558 return false;
559 } 559 }
560 560
561 AtomicString declaredMimeType = document().isPluginDocument() && document(). ownerElement() ? 561 AtomicString declaredMimeType = document().isPluginDocument() && document(). localOwner() ?
562 document().ownerElement()->fastGetAttribute(HTMLNames::typeAttr) : 562 document().localOwner()->fastGetAttribute(HTMLNames::typeAttr) :
563 fastGetAttribute(HTMLNames::typeAttr); 563 fastGetAttribute(HTMLNames::typeAttr);
564 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) 564 if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
565 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) { 565 || !document().contentSecurityPolicy()->allowPluginTypeForDocument(docum ent(), mimeType, declaredMimeType, url)) {
566 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy); 566 layoutEmbeddedItem().setPluginUnavailabilityReason(LayoutEmbeddedObject: :PluginBlockedByContentSecurityPolicy);
567 return false; 567 return false;
568 } 568 }
569 // If the URL is empty, a plugin could still be instantiated if a MIME-type 569 // If the URL is empty, a plugin could still be instantiated if a MIME-type
570 // is specified. 570 // is specified.
571 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, url); 571 return (!mimeType.isEmpty() && url.isEmpty()) || !MixedContentChecker::shoul dBlockFetch(frame, WebURLRequest::RequestContextObject, WebURLRequest::FrameType None, url);
572 } 572 }
(...skipping 25 matching lines...) Expand all
598 598
599 void HTMLPlugInElement::lazyReattachIfNeeded() 599 void HTMLPlugInElement::lazyReattachIfNeeded()
600 { 600 {
601 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) { 601 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) {
602 lazyReattachIfAttached(); 602 lazyReattachIfAttached();
603 setPersistedPluginWidget(nullptr); 603 setPersistedPluginWidget(nullptr);
604 } 604 }
605 } 605 }
606 606
607 } // namespace blink 607 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp ('k') | third_party/WebKit/Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698