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

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

Issue 1005223002: Blink: Replace all "plug-in" with "plugin". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert netscape-dom-access tests. Created 5 years, 9 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
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/layout/LayoutEmbeddedObject.h » ('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) 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); 357 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
358 } else if (name == alignAttr) { 358 } else if (name == alignAttr) {
359 applyAlignmentAttributeToStyle(value, style); 359 applyAlignmentAttributeToStyle(value, style);
360 } else { 360 } else {
361 HTMLFrameOwnerElement::collectStyleForPresentationAttribute(name, value, style); 361 HTMLFrameOwnerElement::collectStyleForPresentationAttribute(name, value, style);
362 } 362 }
363 } 363 }
364 364
365 void HTMLPlugInElement::defaultEventHandler(Event* event) 365 void HTMLPlugInElement::defaultEventHandler(Event* event)
366 { 366 {
367 // Firefox seems to use a fake event listener to dispatch events to plug-in 367 // Firefox seems to use a fake event listener to dispatch events to plugin
368 // (tested with mouse events only). This is observable via different order 368 // (tested with mouse events only). This is observable via different order
369 // of events - in Firefox, event listeners specified in HTML attributes 369 // of events - in Firefox, event listeners specified in HTML attributes
370 // fires first, then an event gets dispatched to plug-in, and only then 370 // fires first, then an event gets dispatched to plugin, and only then
371 // other event listeners fire. Hopefully, this difference does not matter in 371 // other event listeners fire. Hopefully, this difference does not matter in
372 // practice. 372 // practice.
373 373
374 // FIXME: Mouse down and scroll events are passed down to plug-in via custom 374 // FIXME: Mouse down and scroll events are passed down to plugin via custom
375 // code in EventHandler; these code paths should be united. 375 // code in EventHandler; these code paths should be united.
376 376
377 LayoutObject* r = layoutObject(); 377 LayoutObject* r = layoutObject();
378 if (!r || !r->isLayoutPart()) 378 if (!r || !r->isLayoutPart())
379 return; 379 return;
380 if (r->isEmbeddedObject()) { 380 if (r->isEmbeddedObject()) {
381 if (toLayoutEmbeddedObject(r)->showsUnavailablePluginIndicator()) 381 if (toLayoutEmbeddedObject(r)->showsUnavailablePluginIndicator())
382 return; 382 return;
383 } 383 }
384 RefPtrWillBeRawPtr<Widget> widget = toLayoutPart(r)->widget(); 384 RefPtrWillBeRawPtr<Widget> widget = toLayoutPart(r)->widget();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return false; 502 return false;
503 503
504 KURL completedURL = document().completeURL(url); 504 KURL completedURL = document().completeURL(url);
505 if (!pluginIsLoadable(completedURL, mimeType)) 505 if (!pluginIsLoadable(completedURL, mimeType))
506 return false; 506 return false;
507 507
508 bool useFallback; 508 bool useFallback;
509 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac k)) 509 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac k))
510 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa llback, true); 510 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa llback, true);
511 511
512 // If the plug-in element already contains a subframe, 512 // If the plugin element already contains a subframe,
513 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new 513 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new
514 // frame and set it as the LayoutPart's widget, causing what was previously 514 // frame and set it as the LayoutPart's widget, causing what was previously
515 // in the widget to be torn down. 515 // in the widget to be torn down.
516 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true, CheckC ontentSecurityPolicy); 516 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true, CheckC ontentSecurityPolicy);
517 } 517 }
518 518
519 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac k, bool requireRenderer) 519 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac k, bool requireRenderer)
520 { 520 {
521 LocalFrame* frame = document().frame(); 521 LocalFrame* frame = document().frame();
522 522
523 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) 523 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin))
524 return false; 524 return false;
525 525
526 LayoutEmbeddedObject* renderer = layoutEmbeddedObject(); 526 LayoutEmbeddedObject* renderer = layoutEmbeddedObject();
527 // FIXME: This code should not depend on renderer! 527 // FIXME: This code should not depend on renderer!
528 if ((!renderer && requireRenderer) || useFallback) 528 if ((!renderer && requireRenderer) || useFallback)
529 return false; 529 return false;
530 530
531 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); 531 WTF_LOG(Plugins, "%p Plugin URL: %s", this, m_url.utf8().data());
532 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); 532 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data());
533 m_loadedUrl = url; 533 m_loadedUrl = url;
534 534
535 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; 535 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr;
536 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; 536 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget;
537 if (!widget) { 537 if (!widget) {
538 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); 538 bool loadManually = document().isPluginDocument() && !document().contain sPlugins();
539 placeholder = frame->loader().client()->createPluginPlaceholder(document (), url, paramNames, paramValues, mimeType, loadManually); 539 placeholder = frame->loader().client()->createPluginPlaceholder(document (), url, paramNames, paramValues, mimeType, loadManually);
540 if (!placeholder) { 540 if (!placeholder) {
541 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? F rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; 541 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? F rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin;
(...skipping 25 matching lines...) Expand all
567 // Make sure any input event handlers introduced by the plugin are taken int o account. 567 // Make sure any input event handlers introduced by the plugin are taken int o account.
568 if (Page* page = document().frame()->page()) { 568 if (Page* page = document().frame()->page()) {
569 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 569 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
570 scrollingCoordinator->notifyLayoutUpdated(); 570 scrollingCoordinator->notifyLayoutUpdated();
571 } 571 }
572 return true; 572 return true;
573 } 573 }
574 574
575 bool HTMLPlugInElement::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback) 575 bool HTMLPlugInElement::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
576 { 576 {
577 // Allow other plug-ins to win over QuickTime because if the user has 577 // Allow other plugins to win over QuickTime because if the user has
578 // installed a plug-in that can handle TIFF (which QuickTime can also 578 // installed a plugin that can handle TIFF (which QuickTime can also
579 // handle) they probably intended to override QT. 579 // handle) they probably intended to override QT.
580 if (document().frame()->page() && (mimeType == "image/tiff" || mimeType == " image/tif" || mimeType == "image/x-tiff")) { 580 if (document().frame()->page() && (mimeType == "image/tiff" || mimeType == " image/tif" || mimeType == "image/x-tiff")) {
581 const PluginData* pluginData = document().frame()->page()->pluginData(); 581 const PluginData* pluginData = document().frame()->page()->pluginData();
582 String pluginName = pluginData ? pluginData->pluginNameForMimeType(mimeT ype) : String(); 582 String pluginName = pluginData ? pluginData->pluginNameForMimeType(mimeT ype) : String();
583 if (!pluginName.isEmpty() && !pluginName.contains("QuickTime", TextCaseI nsensitive)) 583 if (!pluginName.isEmpty() && !pluginName.contains("QuickTime", TextCaseI nsensitive))
584 return true; 584 return true;
585 } 585 }
586 586
587 ObjectContentType objectType = document().frame()->loader().client()->object ContentType(url, mimeType, shouldPreferPlugInsForImages()); 587 ObjectContentType objectType = document().frame()->loader().client()->object ContentType(url, mimeType, shouldPreferPlugInsForImages());
588 // If an object's content can't be handled and it has no fallback, let 588 // If an object's content can't be handled and it has no fallback, let
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return hasOpenShadowRoot(); 665 return hasOpenShadowRoot();
666 } 666 }
667 667
668 void HTMLPlugInElement::lazyReattachIfNeeded() 668 void HTMLPlugInElement::lazyReattachIfNeeded()
669 { 669 {
670 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && layoutObject() && !isImageType()) 670 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && layoutObject() && !isImageType())
671 lazyReattachIfAttached(); 671 lazyReattachIfAttached();
672 } 672 }
673 673
674 } 674 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/layout/LayoutEmbeddedObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698