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


C++ ResourceRequest函数代码示例

本文整理汇总了C++中ResourceRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ ResourceRequest函数的具体用法?C++ ResourceRequest怎么用?C++ ResourceRequest使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: request

void WebInspector::openInNewTab(const String& urlString)
{
    Page* inspectedPage = m_page->corePage();
    if (!inspectedPage)
        return;

    Frame& inspectedMainFrame = inspectedPage->mainFrame();
    FrameLoadRequest request(inspectedMainFrame.document()->securityOrigin(), ResourceRequest(urlString), "_blank", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);

    Page* newPage = inspectedPage->chrome().createWindow(&inspectedMainFrame, request, WindowFeatures(), NavigationAction(request.resourceRequest(), NavigationType::LinkClicked));
    if (!newPage)
        return;

    newPage->mainFrame().loader().load(request);
}
开发者ID:GaoHuijian,项目名称:webkit,代码行数:15,代码来源:WebInspector.cpp

示例2: expectHeader

    void expectHeader(const char* input, const char* headerName, bool isPresent, const char* headerValue, float width = 0)
    {
        KURL inputURL(ParsedURLString, input);
        FetchRequest fetchRequest = FetchRequest(ResourceRequest(inputURL), FetchInitiatorInfo());
        if (width > 0) {
            FetchRequest::ResourceWidth resourceWidth;
            resourceWidth.width = width;
            resourceWidth.isSet = true;
            fetchRequest.setResourceWidth(resourceWidth);
        }
        fetchContext->addClientHintsIfNecessary(fetchRequest);

        EXPECT_STREQ(isPresent ? headerValue : "",
            fetchRequest.resourceRequest().httpHeaderField(headerName).utf8().data());
    }
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:15,代码来源:FrameFetchContextTest.cpp

示例3: docLoaderFunc

static xmlDocPtr docLoaderFunc(const xmlChar* uri,
                               xmlDictPtr,
                               int options,
                               void* ctxt,
                               xsltLoadType type)
{
    if (!globalProcessor)
        return 0;

    switch (type) {
    case XSLT_LOAD_DOCUMENT: {
        xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt;
        xmlChar* base = xmlNodeGetBase(context->document->doc, context->node);
        KURL url(KURL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
        xmlFree(base);

        ResourceLoaderOptions fetchOptions(ResourceFetcher::defaultResourceOptions());
        FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, fetchOptions);
        request.setOriginRestriction(FetchRequest::RestrictToSameOrigin);
        ResourcePtr<Resource> resource = globalResourceFetcher->fetchSynchronously(request);
        if (!resource || !globalProcessor)
            return 0;

        PageConsole* console = 0;
        Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame();
        if (frame && frame->page())
            console = &frame->page()->console();
        xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc);
        xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc);

        // We don't specify an encoding here. Neither Gecko nor WinIE respects
        // the encoding specified in the HTTP headers.
        SharedBuffer* data = resource->resourceBuffer();
        xmlDocPtr doc = data ? xmlReadMemory(data->data(), data->size(), (const char*)uri, 0, options) : 0;

        xmlSetStructuredErrorFunc(0, 0);
        xmlSetGenericErrorFunc(0, 0);

        return doc;
    }
    case XSLT_LOAD_STYLESHEET:
        return globalProcessor->xslStylesheet()->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri);
    default:
        break;
    }

    return 0;
}
开发者ID:Igalia,项目名称:blink,代码行数:48,代码来源:XSLTProcessorLibxslt.cpp

示例4: fire

    virtual void fire(Frame* frame)
    {
        OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicator();

        if (!m_historySteps) {
            FrameLoadRequest frameRequest(frame->document()->securityOrigin(), ResourceRequest(frame->document()->url()));
            frameRequest.setLockBackForwardList(lockBackForwardList());
            // Special case for go(0) from a frame -> reload only the frame
            // To follow Firefox and IE's behavior, history reload can only navigate the self frame.
            frame->loader().load(frameRequest);
            return;
        }
        // go(i!=0) from a frame navigates into the history of the frame only,
        // in both IE and NS (but not in Mozilla). We can't easily do that.
        frame->page()->mainFrame()->loader().client()->navigateBackForward(m_historySteps);
    }
开发者ID:Igalia,项目名称:blink,代码行数:16,代码来源:NavigationScheduler.cpp

示例5: ASSERT

StyleFetchedImage* CSSImageValue::cachedImage(ResourceFetcher* fetcher, const ResourceLoaderOptions& options)
{
    ASSERT(fetcher);

    if (!m_accessedImage) {
        m_accessedImage = true;

        FetchRequest request(ResourceRequest(m_absoluteURL), m_initiatorName.isEmpty() ? FetchInitiatorTypeNames::css : m_initiatorName, options);
        request.mutableResourceRequest().setHTTPReferrer(m_referrer);

        if (ResourcePtr<ImageResource> cachedImage = fetcher->fetchImage(request))
            m_image = StyleFetchedImage::create(cachedImage.get());
    }

    return (m_image && m_image->isImageResource()) ? toStyleFetchedImage(m_image) : 0;
}
开发者ID:domenic,项目名称:mojo,代码行数:16,代码来源:CSSImageValue.cpp

示例6: TEST_F

TEST_F(CachingCorrectnessTest, PostToSameURLTwice)
{
    ResourceRequest request1(KURL(ParsedURLString, kResourceURL));
    request1.setHTTPMethod(HTTPNames::POST);
    ResourcePtr<Resource> resource1 = new Resource(ResourceRequest(request1.url()), Resource::Raw);
    resource1->setLoading(true);
    memoryCache()->add(resource1.get());

    ResourceRequest request2(KURL(ParsedURLString, kResourceURL));
    request2.setHTTPMethod(HTTPNames::POST);
    FetchRequest fetch2(request2, FetchInitiatorInfo());
    ResourcePtr<Resource> resource2 = RawResource::fetchSynchronously(fetch2, fetcher());

    EXPECT_EQ(resource2, memoryCache()->resourceForURL(request2.url()));
    EXPECT_NE(resource1, resource2);
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:16,代码来源:CachingCorrectnessTest.cpp

示例7: ASSERT

void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, ResourceRequest& request, const ResourceResponse&)
{
    ASSERT(m_client);
    ASSERT_UNUSED(loader, loader == m_loader);

// apollo integrate
//#if PLATFORM(APOLLO)
//    if (!m_document->securityOrigin()->canRequestExt(request.url(), m_document)) {
//#endif
// end apollo integrate
    if (!isAllowedRedirect(request.url())) {
        RefPtr<DocumentThreadableLoader> protect(this);
        m_client->didFailRedirectCheck();
        request = ResourceRequest();
    }
}
开发者ID:digideskio,项目名称:WebkitAIR,代码行数:16,代码来源:DocumentThreadableLoader.cpp

示例8: TEST_F

TEST_F(FrameFetchContextTest, ModifyPriorityForLowPriorityIframes)
{
    Settings* settings = document->frame()->settings();
    settings->setLowPriorityIframes(false);
    FetchRequest request(ResourceRequest("http://www.example.com"), FetchInitiatorInfo());
    FrameFetchContext* childFetchContext = createChildFrame();

    // No low priority iframes, expect default values.
    EXPECT_EQ(ResourceLoadPriorityVeryHigh, childFetchContext->modifyPriorityForExperiments(ResourceLoadPriorityVeryHigh));
    EXPECT_EQ(ResourceLoadPriorityMedium, childFetchContext->modifyPriorityForExperiments(ResourceLoadPriorityMedium));

    // Low priority iframes enabled, everything should be low priority
    settings->setLowPriorityIframes(true);
    EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForExperiments(ResourceLoadPriorityVeryHigh));
    EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForExperiments(ResourceLoadPriorityMedium));
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:16,代码来源:FrameFetchContextTest.cpp

示例9: LOG

void ContentFilter::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)
{
    LOG(ContentFiltering, "ContentFilter received request for <%s> with redirect response from <%s>.\n", request.url().string().ascii().data(), redirectResponse.url().string().ascii().data());
    ResourceRequest requestCopy { request };
    ASSERT(m_state == State::Initialized || m_state == State::Filtering);
    forEachContentFilterUntilBlocked([&requestCopy, &redirectResponse](PlatformContentFilter& contentFilter) {
        contentFilter.willSendRequest(requestCopy, redirectResponse);
        if (contentFilter.didBlockData())
            requestCopy = ResourceRequest();
    });
#if !LOG_DISABLED
    if (request != requestCopy)
        LOG(ContentFiltering, "ContentFilter changed request url to <%s>.\n", requestCopy.url().string().ascii().data());
#endif
    request = requestCopy;
}
开发者ID:hnney,项目名称:webkit,代码行数:16,代码来源:ContentFilter.cpp

示例10: ResourceRequest

void Resource::error(Resource::Status status)
{
    if (!m_revalidatingRequest.isNull())
        m_revalidatingRequest = ResourceRequest();

    if (!m_error.isNull() && (m_error.isCancellation() || !isPreloaded()))
        memoryCache()->remove(this);

    setStatus(status);
    ASSERT(errorOccurred());
    m_data.clear();

    setLoading(false);
    checkNotify();
    markClientsFinished();
}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:16,代码来源:Resource.cpp

示例11: request

void CSSImageValue::restoreCachedResourceIfNeeded(Document& document) const
{
    if (m_isCachePending || !m_cachedImage || !document.fetcher())
        return;
    if (document.fetcher()->cachedResource(KURL(ParsedURLString, m_absoluteURL)))
        return;

    ImageResource* resource = m_cachedImage->cachedImage();
    if (!resource)
        return;

    FetchRequest request(ResourceRequest(m_absoluteURL), m_initiatorName.isEmpty() ? FetchInitiatorTypeNames::css : m_initiatorName, resource->options());
    MixedContentChecker::shouldBlockFetch(document.frame(), resource->lastResourceRequest(),
        resource->lastResourceRequest().url(), MixedContentChecker::SendReport);
    document.fetcher()->requestLoadStarted(resource, request, ResourceFetcher::ResourceLoadingFromCache);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:16,代码来源:CSSImageValue.cpp

示例12: SetUp

 void SetUp() override
 {
     url = KURL(KURL(), "https://example.test/foo");
     securityInfo = "security info";
     mainResourceUrl = KURL(KURL(), "https://www.example.test");
     MockFrameLoaderClient* client = new MockFrameLoaderClient;
     EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(url, securityInfo));
     dummyPageHolder = DummyPageHolder::create(IntSize(500, 500), nullptr, client);
     dummyPageHolder->page().setDeviceScaleFactor(1.0);
     documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), ResourceRequest(mainResourceUrl), SubstituteData());
     document = toHTMLDocument(&dummyPageHolder->document());
     document->setURL(mainResourceUrl);
     fetchContext = static_cast<FrameFetchContext*>(&documentLoader->fetcher()->context());
     owner = DummyFrameOwner::create();
     FrameFetchContext::provideDocumentToContext(*fetchContext, document.get());
 }
开发者ID:endlessm,项目名称:chromium-browser,代码行数:16,代码来源:FrameFetchContextTest.cpp

示例13: ResourceRequest

void ResourceLoader::setDefersLoading(bool defers)
{
    if (m_options.defersLoadingPolicy() == DefersLoadingPolicy::DisallowDefersLoading)
        return;

    m_defersLoading = defers;
    if (m_handle)
        m_handle->setDefersLoading(defers);
    if (!defers && !m_deferredRequest.isNull()) {
        m_request = m_deferredRequest;
        m_deferredRequest = ResourceRequest();
        start();
    }

    platformStrategies()->loaderStrategy()->resourceLoadScheduler()->setDefersLoading(this, defers);
}
开发者ID:home201448,项目名称:webkit,代码行数:16,代码来源:ResourceLoader.cpp

示例14: request

void IconLoader::startLoading()
{
    if (m_resource || !m_frame.document())
        return;

    CachedResourceRequest request(ResourceRequest(m_frame.loader().icon().url()), ResourceLoaderOptions(SendCallbacks, SniffContent, BufferData, DoNotAllowStoredCredentials, DoNotAskClientForAnyCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo));

    request.mutableResourceRequest().setPriority(ResourceLoadPriorityLow);
    request.setInitiator(cachedResourceRequestInitiators().icon);

    m_resource = m_frame.document()->cachedResourceLoader().requestRawResource(request);
    if (m_resource)
        m_resource->addClient(this);
    else
        LOG_ERROR("Failed to start load for icon at url %s", m_frame.loader().icon().url().string().ascii().data());
}
开发者ID:houzhenggang,项目名称:webkit,代码行数:16,代码来源:IconLoader.cpp

示例15: URL

void StyleRuleImport::requestStyleSheet()
{
    if (!m_parentStyleSheet)
        return;
    Document* document = m_parentStyleSheet->singleOwnerDocument();
    if (!document)
        return;

    CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader();
    if (!cachedResourceLoader)
        return;

    URL absURL;
    if (!m_parentStyleSheet->baseURL().isNull())
        // use parent styleheet's URL as the base URL
        absURL = URL(m_parentStyleSheet->baseURL(), m_strHref);
    else
        absURL = document->completeURL(m_strHref);

    // Check for a cycle in our import chain.  If we encounter a stylesheet
    // in our parent chain with the same URL, then just bail.
    StyleSheetContents* rootSheet = m_parentStyleSheet;
    for (StyleSheetContents* sheet = m_parentStyleSheet; sheet; sheet = sheet->parentStyleSheet()) {
        if (equalIgnoringFragmentIdentifier(absURL, sheet->baseURL())
            || equalIgnoringFragmentIdentifier(absURL, document->completeURL(sheet->originalURL())))
            return;
        rootSheet = sheet;
    }

    CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset());
    request.setInitiator(cachedResourceRequestInitiators().css);
    if (m_cachedSheet)
        m_cachedSheet->removeClient(&m_styleSheetClient);
    if (m_parentStyleSheet->isUserStyleSheet())
        m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request);
    else
        m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request);
    if (m_cachedSheet) {
        // if the import rule is issued dynamically, the sheet may be
        // removed from the pending sheet count, so let the doc know
        // the sheet being imported is pending.
        if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootSheet == m_parentStyleSheet)
            m_parentStyleSheet->startLoadingDynamicSheet();
        m_loading = true;
        m_cachedSheet->addClient(&m_styleSheetClient);
    }
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:47,代码来源:StyleRuleImport.cpp


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