void HTMLPlugInImageElement::restartSimilarPlugIns() { // Restart any other snapshotted plugins in the page with the same origin. Note that they // may be in different frames, so traverse from the top of the document. String plugInOrigin = m_loadedUrl.host(); String mimeType = loadedMimeType(); HTMLPlugInImageElementList pluginsNeedingRestart; if (!document()->page()) return; for (Frame* frame = document()->page()->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->loader()->subframeLoader()->containsPlugins()) { if (!frame->document()) continue; RefPtr<NodeList> plugins = frame->document()->getElementsByTagName(embedTag.localName()); if (plugins) addPlugInsFromNodeListMatchingPlugInOrigin(pluginsNeedingRestart, plugins, plugInOrigin, mimeType); plugins = frame->document()->getElementsByTagName(objectTag.localName()); if (plugins) addPlugInsFromNodeListMatchingPlugInOrigin(pluginsNeedingRestart, plugins, plugInOrigin, mimeType); } } for (size_t i = 0, length = pluginsNeedingRestart.size(); i < length; i++) { pluginsNeedingRestart[i]->setDisplayState(Playing); pluginsNeedingRestart[i]->restartSnapshottedPlugIn(); } }
void HTMLPlugInImageElement::restartSimilarPlugIns() { // Restart any other snapshotted plugins in the page with the same origin. Note that they // may be in different frames, so traverse from the top of the document. String plugInOrigin = m_loadedUrl.host(); String mimeType = loadedMimeType(); HTMLPlugInImageElementList similarPlugins; if (!document()->page()) return; for (Frame* frame = document()->page()->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (!frame->loader()->subframeLoader()->containsPlugins()) continue; if (!frame->document()) continue; RefPtr<NodeList> plugIns = frame->document()->getElementsByTagName(embedTag.localName()); if (plugIns) addPlugInsFromNodeListMatchingPlugInOrigin(similarPlugins, plugIns, plugInOrigin, mimeType); plugIns = frame->document()->getElementsByTagName(objectTag.localName()); if (plugIns) addPlugInsFromNodeListMatchingPlugInOrigin(similarPlugins, plugIns, plugInOrigin, mimeType); } for (size_t i = 0, length = similarPlugins.size(); i < length; ++i) { HTMLPlugInImageElement* plugInToRestart = similarPlugins[i].get(); if (plugInToRestart->displayState() <= HTMLPlugInElement::DisplayingSnapshot) { LOG(Plugins, "%p Plug-in looks similar to a restarted plug-in. Restart.", plugInToRestart); plugInToRestart->setDisplayState(Playing); plugInToRestart->restartSnapshottedPlugIn(); } plugInToRestart->m_snapshotDecision = NeverSnapshot; } }
void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event) { m_pendingClickEventFromSnapshot = event; if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol())) document()->page()->plugInClient()->addAutoStartOrigin(document()->page()->mainFrame()->document()->baseURL().host(), m_plugInOriginHash); restartSnapshottedPlugIn(); // Restart any other snapshotted plugins in the page with the same origin. Note that they // may be in different frames, so traverse from the top of the document. HTMLPlugInImageElementList pluginsNeedingRestart; if (!document()->page()) return; for (Frame* frame = document()->page()->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->loader()->subframeLoader()->containsPlugins()) { if (!frame->document()) continue; RefPtr<NodeList> plugins = frame->document()->getElementsByTagName(embedTag.localName()); if (plugins) addPlugInsFromNodeListMatchingOriginHash(pluginsNeedingRestart, plugins, m_plugInOriginHash); plugins = frame->document()->getElementsByTagName(objectTag.localName()); if (plugins) addPlugInsFromNodeListMatchingOriginHash(pluginsNeedingRestart, plugins, m_plugInOriginHash); } } for (size_t i = 0, length = pluginsNeedingRestart.size(); i < length; i++) { pluginsNeedingRestart[i]->setDisplayState(Playing); pluginsNeedingRestart[i]->restartSnapshottedPlugIn(); } }