当前位置: 首页>>代码示例>>C++>>正文


C++ FrameLoader::setForceSandboxFlags方法代码示例

本文整理汇总了C++中FrameLoader::setForceSandboxFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameLoader::setForceSandboxFlags方法的具体用法?C++ FrameLoader::setForceSandboxFlags怎么用?C++ FrameLoader::setForceSandboxFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrameLoader的用法示例。


在下文中一共展示了FrameLoader::setForceSandboxFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dataChanged

bool SVGImage::dataChanged(bool allDataReceived)
{
    // Don't do anything if is an empty image.
    if (!data()->size())
        return true;

    if (allDataReceived) {
        static FrameLoaderClient* dummyFrameLoaderClient =  new EmptyFrameLoaderClient;
        static EditorClient* dummyEditorClient = new EmptyEditorClient;
#if ENABLE(CONTEXT_MENUS)
        static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
#else
        static ContextMenuClient* dummyContextMenuClient = 0;
#endif
#if ENABLE(DRAG_SUPPORT)
        static DragClient* dummyDragClient = new EmptyDragClient;
#else
        static DragClient* dummyDragClient = 0;
#endif
        static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;

        m_chromeClient.set(new SVGImageChromeClient(this));
        
        // FIXME: If this SVG ends up loading itself, we might leak the world.
        // The comment said that the Cache code does not know about CachedImages
        // holding Frames and won't know to break the cycle. But 
        m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0, 0));
        m_page->settings()->setMediaEnabled(false);
        m_page->settings()->setJavaScriptEnabled(false);
        m_page->settings()->setPluginsEnabled(false);

        RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient);
        frame->setView(FrameView::create(frame.get()));
        frame->init();
        ResourceRequest fakeRequest(KURL(ParsedURLString, ""));
        FrameLoader* loader = frame->loader();
        loader->setForceSandboxFlags(SandboxAll);
        loader->load(fakeRequest, false); // Make sure the DocumentLoader is created
        loader->policyChecker()->cancelCheck(); // cancel any policy checks
        loader->commitProvisionalLoad(0);
        loader->setResponseMIMEType("image/svg+xml");
        loader->begin(KURL()); // create the empty document
        loader->write(data()->data(), data()->size());
        loader->end();
        frame->view()->setTransparent(true); // SVG Images are transparent.
    }

    return m_page;
}
开发者ID:,项目名称:,代码行数:49,代码来源:


注:本文中的FrameLoader::setForceSandboxFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。