本文整理汇总了C++中FrameLoader::frame方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameLoader::frame方法的具体用法?C++ FrameLoader::frame怎么用?C++ FrameLoader::frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameLoader
的用法示例。
在下文中一共展示了FrameLoader::frame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getResourceDocumentNode
static JSValueRef getResourceDocumentNode(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 || argumentCount > 1 || !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;
FrameLoader* frameLoader = resource->loader->frameLoader();
if (!frameLoader)
return undefined;
Document* document = frameLoader->frame()->document();
if (!document)
return undefined;
if (document->isPluginDocument() || document->isImageDocument())
return undefined;
KJS::JSLock lock;
JSValueRef documentValue = toRef(toJS(toJS(controller->scriptContext()), document));
return documentValue;
}
示例2: type
Type type() const
{
if (requestURL == loader->requestURL())
return Doc;
FrameLoader* frameLoader = loader->frameLoader();
if (!frameLoader)
return Other;
if (requestURL == frameLoader->iconURL())
return Image;
Document* doc = frameLoader->frame()->document();
if (!doc)
return Other;
CachedResource* cachedResource = doc->docLoader()->cachedResource(requestURL.url());
if (!cachedResource)
return Other;
switch (cachedResource->type()) {
case CachedResource::ImageResource:
return Image;
case CachedResource::CSSStyleSheet:
#if ENABLE(XSLT)
case CachedResource::XSLStyleSheet:
#endif
return Stylesheet;
case CachedResource::Script:
return Script;
default:
return Other;
}
}
示例3: getFrame
Frame* ResourceLoader::getFrame()
{
Frame* retVal = NULL;
FrameLoader* pFrameLoader = frameLoader();
if(pFrameLoader != NULL)
{
retVal = pFrameLoader->frame();
}
return retVal;
}
示例4: 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;
}