| 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..e0c1215bbe6bbcf38e39c25301bece63901d8876 100644
|
| --- a/content/browser/frame_host/navigation_request.cc
|
| +++ b/content/browser/frame_host/navigation_request.cc
|
| @@ -13,25 +13,35 @@ namespace content {
|
|
|
| namespace {
|
|
|
| +// The next available browser-global navigation request ID.
|
| +static int64 next_navigation_request_id_ = 0;
|
| +
|
| void OnBeginNavigation(const NavigationRequestInfo& info,
|
| scoped_refptr<ResourceRequestBody> request_body,
|
| - int64 frame_node_id) {
|
| + int64 navigation_request_id,
|
| + int64 frame_tree_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_tree_node_id);
|
| +}
|
| +
|
| +void CancelNavigationRequest(int64 navigation_request_id,
|
| + int64 frame_tree_node_id) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + ResourceDispatcherHostImpl::Get()->CancelNavigationRequest(
|
| + navigation_request_id, frame_tree_node_id);
|
| }
|
|
|
| } // namespace
|
|
|
| NavigationRequest::NavigationRequest(const NavigationRequestInfo& info,
|
| - int64 frame_node_id)
|
| - : info_(info),
|
| - frame_node_id_(frame_node_id) {
|
| + int64 frame_tree_node_id)
|
| + : navigation_request_id_(++next_navigation_request_id_),
|
| + info_(info),
|
| + frame_tree_node_id_(frame_tree_node_id) {
|
| }
|
|
|
| NavigationRequest::~NavigationRequest() {
|
| - // TODO(clamy): Cancel the corresponding request in ResourceDispatcherHost if
|
| - // it has not commited yet.
|
| }
|
|
|
| void NavigationRequest::BeginNavigation(
|
| @@ -40,7 +50,20 @@ 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_tree_node_id_));
|
| +}
|
| +
|
| +void NavigationRequest::CancelNavigation() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(&CancelNavigationRequest,
|
| + navigation_request_id_, frame_tree_node_id_));
|
| }
|
|
|
| } // namespace content
|
|
|