本文整理汇总了C++中FrameLoader::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameLoader::end方法的具体用法?C++ FrameLoader::end怎么用?C++ FrameLoader::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameLoader
的用法示例。
在下文中一共展示了FrameLoader::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSourceToFrame
bool InspectorBackend::addSourceToFrame(const String& mimeType, const String& source, Node* frameNode)
{
ASSERT_ARG(frameNode, frameNode);
if (!frameNode)
return false;
if (!frameNode->attached()) {
ASSERT_NOT_REACHED();
return false;
}
ASSERT(frameNode->isElementNode());
if (!frameNode->isElementNode())
return false;
Element* element = static_cast<Element*>(frameNode);
ASSERT(element->isFrameOwnerElement());
if (!element->isFrameOwnerElement())
return false;
HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(element);
ASSERT(frameOwner->contentFrame());
if (!frameOwner->contentFrame())
return false;
FrameLoader* loader = frameOwner->contentFrame()->loader();
loader->setResponseMIMEType(mimeType);
loader->begin();
loader->write(source);
loader->end();
return true;
}
示例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;
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;
}
示例3: addSourceToFrame
static JSValueRef addSourceToFrame(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/)
{
JSValueRef undefined = JSValueMakeUndefined(ctx);
InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
if (argumentCount < 2 || !controller)
return undefined;
JSValueRef identifierValue = arguments[0];
if (!JSValueIsNumber(ctx, identifierValue))
return undefined;
unsigned long identifier = static_cast<unsigned long>(JSValueToNumber(ctx, identifierValue, 0));
RefPtr<InspectorResource> resource = controller->resources().get(identifier);
ASSERT(resource);
if (!resource)
return undefined;
RefPtr<SharedBuffer> buffer;
if (resource->requestURL == resource->loader->requestURL())
buffer = resource->loader->mainResourceData();
else {
FrameLoader* frameLoader = resource->loader->frameLoader();
if (!frameLoader)
return undefined;
Document* doc = frameLoader->frame()->document();
if (!doc)
return undefined;
CachedResource* cachedResource = doc->docLoader()->cachedResource(resource->requestURL.url());
if (!cachedResource)
return undefined;
buffer = cachedResource->data();
}
if (!buffer)
return undefined;
String textEncodingName = resource->loader->overrideEncoding();
if (!textEncodingName)
textEncodingName = resource->textEncodingName;
TextEncoding encoding(textEncodingName);
if (!encoding.isValid())
encoding = WindowsLatin1Encoding();
String sourceString = encoding.decode(buffer->data(), buffer->size());
Node* node = toNode(toJS(arguments[1]));
ASSERT(node);
if (!node)
return undefined;
if (!node->attached()) {
ASSERT_NOT_REACHED();
return undefined;
}
ASSERT(node->isElementNode());
if (!node->isElementNode())
return undefined;
Element* element = static_cast<Element*>(node);
ASSERT(element->isFrameOwnerElement());
if (!element->isFrameOwnerElement())
return undefined;
HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(element);
ASSERT(frameOwner->contentFrame());
if (!frameOwner->contentFrame())
return undefined;
FrameLoader* loader = frameOwner->contentFrame()->loader();
loader->setResponseMIMEType(resource->mimeType);
loader->begin();
loader->write(sourceString);
loader->end();
return undefined;
}