本文整理汇总了C++中ImageResource::setResponse方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageResource::setResponse方法的具体用法?C++ ImageResource::setResponse怎么用?C++ ImageResource::setResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageResource
的用法示例。
在下文中一共展示了ImageResource::setResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finish
void ImageDocumentParser::finish()
{
if (!isStopped() && document()->imageElement() && document()->cachedImage()) {
ImageResource* cachedImage = document()->cachedImage();
DocumentLoader* loader = document()->loader();
cachedImage->setResponse(loader->response());
cachedImage->setLoadFinishTime(loader->timing().responseEnd());
cachedImage->finish();
// Report the natural image size in the page title, regardless of zoom level.
// At a zoom level of 1 the image is guaranteed to have an integer size.
IntSize size = flooredIntSize(cachedImage->imageSizeForLayoutObject(document()->imageElement()->layoutObject(), 1.0f));
if (size.width()) {
// Compute the title, we use the decoded filename of the resource, falling
// back on the (decoded) hostname if there is no path.
String fileName = decodeURLEscapeSequences(document()->url().lastPathComponent());
if (fileName.isEmpty())
fileName = document()->url().host();
document()->setTitle(imageTitle(fileName, size));
}
document()->imageUpdated();
}
// TODO(esprehn): These null checks on Document don't make sense, document()
// will ASSERT if it was null. Do these want to check isDetached() ?
if (document())
document()->finishedParsing();
}
示例2: finish
void ImageDocumentParser::finish()
{
if (!isStopped() && document()->imageElement() && document()->cachedImage()) {
ImageResource* cachedImage = document()->cachedImage();
cachedImage->finish();
cachedImage->setResponse(document()->frame()->loader().documentLoader()->response());
// Report the natural image size in the page title, regardless of zoom level.
// At a zoom level of 1 the image is guaranteed to have an integer size.
IntSize size = flooredIntSize(cachedImage->imageSizeForLayoutObject(document()->imageElement()->layoutObject(), 1.0f));
if (size.width()) {
// Compute the title, we use the decoded filename of the resource, falling
// back on the (decoded) hostname if there is no path.
String fileName = decodeURLEscapeSequences(document()->url().lastPathComponent());
if (fileName.isEmpty())
fileName = document()->url().host();
document()->setTitle(imageTitle(fileName, size));
}
document()->imageUpdated();
}
if (document())
document()->finishedParsing();
}