void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn)
{
    if (isPrimarySnapshottedPlugIn) {
        restartSnapshottedPlugIn();
        restartSimilarPlugIns();
    }
}
void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event)
{
    m_pendingClickEventFromSnapshot = event;
    String plugInOrigin = m_loadedUrl.host();
    if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()))
        document()->page()->plugInClient()->didStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), plugInOrigin, loadedMimeType());

    restartSnapshottedPlugIn();
    restartSimilarPlugIns();
}
Esempio n. 3
0
void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn)
{
    if (!document()->page() || !document()->page()->settings()->primaryPlugInSnapshotDetectionEnabled() || document()->page()->settings()->snapshotAllPlugIns())
        return;

    if (isPrimarySnapshottedPlugIn) {
        restartSnapshottedPlugIn();
        restartSimilarPlugIns();
    }
}
Esempio n. 4
0
void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event, bool forwardEvent)
{
    if (forwardEvent)
        m_pendingClickEventFromSnapshot = event;

    String plugInOrigin = m_loadedUrl.host();
    if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()) && document()->page()->settings()->autostartOriginPlugInSnapshottingEnabled())
        document()->page()->plugInClient()->didStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), plugInOrigin, loadedMimeType());

    LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
    restartSnapshottedPlugIn();
    restartSimilarPlugIns();
}
Esempio n. 5
0
void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn)
{
    if (!document()->page() || !document()->page()->settings()->primaryPlugInSnapshotDetectionEnabled() || document()->page()->settings()->snapshotAllPlugIns())
        return;

    if (isPrimarySnapshottedPlugIn) {
        if (m_plugInWasCreated) {
            LOG(Plugins, "%p Plug-in was detected as the primary element in the page. Restart.", this);
            restartSnapshottedPlugIn();
            restartSimilarPlugIns();
        } else {
            LOG(Plugins, "%p Plug-in was detected as the primary element in the page, but is not yet created. Will restart later.", this);
            m_deferredPromotionToPrimaryPlugIn = true;
        }
    }
}
Esempio n. 6
0
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();
    }
}