void MediaPlayerPrivate::onConditionallyEnterFullscreen()
{
    Document* owningDocument = m_webCorePlayer->mediaPlayerClient()->mediaPlayerOwningDocument();
    BlackBerry::Platform::DeviceInfo* info = BlackBerry::Platform::DeviceInfo::instance();

    // Don't allow video in <embed> and <object> containers to go fullscreen
    // on play because this does not currently work. Detect this by checking
    // for MediaDocument with a parent document.
    if (owningDocument->isMediaDocument() && owningDocument->parentDocument())
        return;

    if (info->isMobile()) {
        // This is a mobile device (small screen), not a tablet, so we
        // enter fullscreen video on user-initiated plays.
        bool nothingIsFullscreen = !m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsFullscreen();
#if ENABLE(FULLSCREEN_API)
        if (owningDocument->webkitIsFullScreen())
            nothingIsFullscreen = false;
#endif
        if (nothingIsFullscreen)
            m_webCorePlayer->mediaPlayerClient()->mediaPlayerEnterFullscreen();
    }
}
void MediaPlayerPrivate::conditionallyGoFullscreenAfterPlay()
{
    BlackBerry::Platform::DeviceInfo* info = BlackBerry::Platform::DeviceInfo::instance();
    if (hasVideo() && m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsFullscreenPermitted() && info->isMobile()) {
        // This is a mobile device (small screen), not a tablet, so we
        // enter fullscreen video on user-initiated plays.
        bool nothingIsFullscreen = !m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsFullscreen();
#if ENABLE(FULLSCREEN_API)
        if (m_webCorePlayer->mediaPlayerClient()->mediaPlayerOwningDocument()->webkitIsFullScreen())
            nothingIsFullscreen = false;
#endif
        if (nothingIsFullscreen && currentTime() == 0.0f) {
            // Only enter fullscreen when playing from the beginning. Doing
            // so on every play is sure to annoy the user who does not want
            // to watch the video fullscreen. Note that the following call
            // will fail if we are not here due to a user gesture, as per the
            // check in Document::requestFullScreenForElement() to prevent
            // popups.
            m_webCorePlayer->mediaPlayerClient()->mediaPlayerEnterFullscreen();
        }
    }
}