本文整理汇总了C++中FrameLoader::setForcedSandboxFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameLoader::setForcedSandboxFlags方法的具体用法?C++ FrameLoader::setForcedSandboxFlags怎么用?C++ FrameLoader::setForcedSandboxFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameLoader
的用法示例。
在下文中一共展示了FrameLoader::setForcedSandboxFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
Page::PageClients pageClients;
m_chromeClient = adoptPtr(new SVGImageChromeClient(this));
pageClients.chromeClient = m_chromeClient.get();
#if ENABLE(CONTEXT_MENUS)
static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
pageClients.contextMenuClient = dummyContextMenuClient;
#endif
static EditorClient* dummyEditorClient = new EmptyEditorClient;
pageClients.editorClient = dummyEditorClient;
#if ENABLE(DRAG_SUPPORT)
static DragClient* dummyDragClient = new EmptyDragClient;
pageClients.dragClient = dummyDragClient;
#endif
static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;
pageClients.inspectorClient = dummyInspectorClient;
#if ENABLE(DEVICE_ORIENTATION)
static DeviceMotionClient* dummyDeviceMotionClient = new EmptyDeviceMotionClient;
pageClients.deviceMotionClient = dummyDeviceMotionClient;
static DeviceOrientationClient* dummyDeviceOrientationClient = new EmptyDeviceOrientationClient;
pageClients.deviceOrientationClient = dummyDeviceOrientationClient;
#endif
// 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(pageClients));
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->setForcedSandboxFlags(SandboxAll);
loader->load(fakeRequest, false); // Make sure the DocumentLoader is created
loader->policyChecker()->cancelCheck(); // cancel any policy checks
loader->commitProvisionalLoad();
loader->writer()->setMIMEType("image/svg+xml");
loader->writer()->begin(KURL()); // create the empty document
loader->writer()->addData(data()->data(), data()->size());
loader->writer()->end();
frame->view()->setTransparent(true); // SVG Images are transparent.
}
return m_page;
}
示例2: 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;
Page::PageClients pageClients;
m_chromeClient = adoptPtr(new SVGImageChromeClient(this));
pageClients.chromeClient = m_chromeClient.get();
#if ENABLE(CONTEXT_MENUS)
static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient;
pageClients.contextMenuClient = dummyContextMenuClient;
#endif
static EditorClient* dummyEditorClient = new EmptyEditorClient;
pageClients.editorClient = dummyEditorClient;
#if ENABLE(DRAG_SUPPORT)
static DragClient* dummyDragClient = new EmptyDragClient;
pageClients.dragClient = dummyDragClient;
#endif
static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;
pageClients.inspectorClient = dummyInspectorClient;
#if ENABLE(DEVICE_ORIENTATION)
static DeviceMotionClient* dummyDeviceMotionClient = new EmptyDeviceMotionClient;
pageClients.deviceMotionClient = dummyDeviceMotionClient;
static DeviceOrientationClient* dummyDeviceOrientationClient = new EmptyDeviceOrientationClient;
pageClients.deviceOrientationClient = dummyDeviceOrientationClient;
#endif
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The Cache code does not know about CachedImages holding Frames and
// won't know to break the cycle.
// This will become an issue when SVGImage will be able to load other
// SVGImage objects, but we're safe now, because SVGImage can only be
// loaded by a top-level document.
m_page.set(new Page(pageClients));
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();
FrameLoader* loader = frame->loader();
loader->setForcedSandboxFlags(SandboxAll);
ASSERT(loader->activeDocumentLoader()); // DocumentLoader should have been created by frame->init().
loader->activeDocumentLoader()->writer()->setMIMEType("image/svg+xml");
loader->activeDocumentLoader()->writer()->begin(KURL()); // create the empty document
loader->activeDocumentLoader()->writer()->addData(data()->data(), data()->size());
loader->activeDocumentLoader()->writer()->end();
frame->view()->setTransparent(true); // SVG Images are transparent.
}
return m_page;
}