| Index: content/browser/frame_host/navigation_request.cc
|
| diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
|
| index fb46ae59b3d9c10ad87d021dd60dd5010efb342f..f8058663d9c96897724be87963fdbea50b57708b 100644
|
| --- a/content/browser/frame_host/navigation_request.cc
|
| +++ b/content/browser/frame_host/navigation_request.cc
|
| @@ -15,23 +15,40 @@ namespace {
|
|
|
| void OnBeginNavigation(const NavigationRequestInfo& info,
|
| scoped_refptr<ResourceRequestBody> request_body,
|
| + int64 navigation_request_id,
|
| int64 frame_node_id) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - ResourceDispatcherHostImpl::Get()->NavigationRequest(
|
| - info, request_body, frame_node_id);
|
| + ResourceDispatcherHostImpl::Get()->StartNavigationRequest(
|
| + info, request_body, navigation_request_id, frame_node_id);
|
| +}
|
| +
|
| +void CancelNavigationRequest(int64 navigation_request_id,
|
| + int64 frame_node_id) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + ResourceDispatcherHostImpl::Get()->CancelNavigationRequest(
|
| + navigation_request_id, frame_node_id);
|
| }
|
|
|
| } // namespace
|
|
|
| +int64 NavigationRequest::next_navigation_request_id_ = 0;
|
| +
|
| NavigationRequest::NavigationRequest(const NavigationRequestInfo& info,
|
| int64 frame_node_id)
|
| - : info_(info),
|
| + : navigation_request_id_(++next_navigation_request_id_),
|
| + info_(info),
|
| frame_node_id_(frame_node_id) {
|
| }
|
|
|
| NavigationRequest::~NavigationRequest() {
|
| - // TODO(clamy): Cancel the corresponding request in ResourceDispatcherHost if
|
| - // it has not commited yet.
|
| + // TODO(carlosk): Figure out when the navigation actually needs to be
|
| + // canceled (currently it's always being invoked).
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(&CancelNavigationRequest,
|
| + navigation_request_id_, frame_node_id_));
|
| }
|
|
|
| void NavigationRequest::BeginNavigation(
|
| @@ -40,7 +57,11 @@ void NavigationRequest::BeginNavigation(
|
| BrowserThread::PostTask(
|
| BrowserThread::IO,
|
| FROM_HERE,
|
| - base::Bind(&OnBeginNavigation, info_, request_body, frame_node_id_));
|
| + base::Bind(&OnBeginNavigation,
|
| + info_,
|
| + request_body,
|
| + navigation_request_id_,
|
| + frame_node_id_));
|
| }
|
|
|
| } // namespace content
|
|
|