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

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

Issue 23618022: BrowserPlugin/WebView - Move plugin lifetime to DOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleaned up. Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 // FIXME: This code should not depend on renderer! 253 // FIXME: This code should not depend on renderer!
254 if (!renderer || useFallback) 254 if (!renderer || useFallback)
255 return false; 255 return false;
256 256
257 LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); 257 LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data());
258 LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); 258 LOG(Plugins, " Loaded URL: %s", url.string().utf8().data());
259 m_loadedUrl = url; 259 m_loadedUrl = url;
260 260
261 IntSize contentSize = roundedIntSize(LayoutSize(renderer->contentWidth(), re nderer->contentHeight())); 261 IntSize contentSize = roundedIntSize(LayoutSize(renderer->contentWidth(), re nderer->contentHeight()));
262 bool loadManually = document().isPluginDocument() && !frame->loader()->conta insPlugins() && toPluginDocument(document()).shouldLoadPluginManually(); 262 RefPtr<Widget> widget = plugin();
263 RefPtr<Widget> widget = frame->loader()->client()->createPlugin(contentSize, this, url, paramNames, paramValues, mimeType, loadManually); 263
264 if (!widget) {
265 bool loadManually = document().isPluginDocument() && !frame->loader()->c ontainsPlugins() && toPluginDocument(document()).shouldLoadPluginManually();
266 widget = frame->loader()->client()->createPlugin(contentSize, this, url, paramNames, paramValues, mimeType, loadManually);
267 }
264 268
265 if (!widget) { 269 if (!widget) {
266 if (!renderer->showsUnavailablePluginIndicator()) 270 if (!renderer->showsUnavailablePluginIndicator())
267 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); 271 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing);
268 return false; 272 return false;
269 } 273 }
270 274
271 renderer->setWidget(widget); 275 renderer->setWidget(widget);
276 if (widget->isPluginContainer() && widget->pluginShouldPersist())
277 setPlugin(widget);
272 frame->loader()->setContainsPlugins(); 278 frame->loader()->setContainsPlugins();
273 setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer); 279 setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
274 return true; 280 return true;
275 } 281 }
276 282
277 bool HTMLPlugInImageElement::shouldUsePlugin(const KURL& url, const String& mime Type, bool hasFallback, bool& useFallback) 283 bool HTMLPlugInImageElement::shouldUsePlugin(const KURL& url, const String& mime Type, bool hasFallback, bool& useFallback)
278 { 284 {
279 // Allow other plug-ins to win over QuickTime because if the user has instal led a plug-in that 285 // Allow other plug-ins to win over QuickTime because if the user has instal led a plug-in that
280 // can handle TIFF (which QuickTime can also handle) they probably intended to override QT. 286 // can handle TIFF (which QuickTime can also handle) they probably intended to override QT.
281 if (document().frame()->page() && (mimeType == "image/tiff" || mimeType == " image/tif" || mimeType == "image/x-tiff")) { 287 if (document().frame()->page() && (mimeType == "image/tiff" || mimeType == " image/tif" || mimeType == "image/x-tiff")) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje ct::PluginBlockedByContentSecurityPolicy); 327 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje ct::PluginBlockedByContentSecurityPolicy);
322 return false; 328 return false;
323 } 329 }
324 330
325 if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecu reContent(document().securityOrigin(), url)) 331 if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecu reContent(document().securityOrigin(), url))
326 return false; 332 return false;
327 return true; 333 return true;
328 } 334 }
329 335
330 } // namespace WebCore 336 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698