Webkit Download files

1. WebView.loadUrl

......

2.bool MainResourceLoader::loadNow(ResourceRequest& r)

3.m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, this, false, true);

....

network

.....

4.void MainResourceLoader::didReceiveResponse(const ResourceResponse& r).(this will be called when the first package comes)

5.MainResourceLoader.cpp    frameLoader()->policyChecker()->checkContentPolicy(m_response.mimeType(), callContinueAfterContentPolicy, this);

//first checkContentpolicy and then call the func pointer that passed in.

6.void MainResourceLoader::callContinueAfterContentPolicy(void* argument, PolicyAction policy)

//policy already nailed down.

7.void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy)

8.void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy, const ResourceResponse& r)

void MainResourceLoader::continueAfterContentPolicy(
    PolicyAction contentPolicy, const ResourceResponse& r)
{
    KURL url = request().url();
    const String& mimeType = r.mimeType();
    
    switch (contentPolicy) {
    case PolicyUse: {
        .....
        break;
    }

    case PolicyDownload:
       .....
        return;
    .......
}
9.void FrameLoaderClientAndroid::download(ResourceHandle* handle, const ResourceRequest&)

handle->getInternal()->m_loader->downloadFile();
10.  ResourceLoaderAndroid->downloadFile()


for apache stack

11. void WebCoreResourceLoader::downloadFile()

env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID); 
12.LoadListener.downloadFile().

mBrowserFrame.getCallbackProxy().onDownloadStart()
......


for chromium stack

11.WebURLLoader->downloadFile();

12.WebUrlLoaderClient->downlaodFile()

13.WebCoreFrameBridge.cpp->downloadStart(m_response->getUrl(), m_request->getUserAgent(), contentDisposition, m_response->getMimeType(), m_response->getExpectedSize());

14. BrowserFrame.downloadStart()

to downloadManager




main resource when to check media type?

MainResourceLoader receive data to checkType
1.MainResourceLoader::didReceiveResponse
is a subBranch of the parse process.
in the main Branch 
FrameLoaderClient::committedLoad will call DocumentLoader::commitData
but it will also call MainResourceLoader::didReceiveResponse,by the way.
2.PolicyChecker::checkContentPolicy
FrameLoaderClientAndroid::
call TreatAsAttachment and canShowMIMEType to determine
call "DOMImplementation::isTextMIMEType"


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值