OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/frame_host/navigation_request_info.h" | |
8 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 9 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
9 #include "content/common/resource_request_body.h" | 10 #include "content/common/resource_request_body.h" |
10 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // The next available browser-global navigation request ID. | 17 // The next available browser-global navigation request ID. |
17 static int64 next_navigation_request_id_ = 0; | 18 static int64 next_navigation_request_id_ = 0; |
18 | 19 |
19 void OnBeginNavigation(const NavigationRequestInfo& info, | 20 void OnBeginNavigation(const CoreNavigationParams& core_params, |
21 const NavigationRequestInfo& info, | |
20 scoped_refptr<ResourceRequestBody> request_body, | 22 scoped_refptr<ResourceRequestBody> request_body, |
21 int64 navigation_request_id, | 23 int64 navigation_request_id, |
22 int64 frame_tree_node_id) { | 24 int64 frame_tree_node_id) { |
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
24 ResourceDispatcherHostImpl::Get()->StartNavigationRequest( | 26 ResourceDispatcherHostImpl::Get()->StartNavigationRequest( |
25 info, request_body, navigation_request_id, frame_tree_node_id); | 27 core_params, |
28 info, | |
29 request_body, | |
30 navigation_request_id, | |
31 frame_tree_node_id); | |
26 } | 32 } |
27 | 33 |
28 void CancelNavigationRequest(int64 navigation_request_id, | 34 void CancelNavigationRequest(int64 navigation_request_id, |
29 int64 frame_tree_node_id) { | 35 int64 frame_tree_node_id) { |
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
31 ResourceDispatcherHostImpl::Get()->CancelNavigationRequest( | 37 ResourceDispatcherHostImpl::Get()->CancelNavigationRequest( |
32 navigation_request_id, frame_tree_node_id); | 38 navigation_request_id, frame_tree_node_id); |
33 } | 39 } |
34 | 40 |
35 } // namespace | 41 } // namespace |
36 | 42 |
37 NavigationRequest::NavigationRequest(const NavigationRequestInfo& info, | 43 NavigationRequest::NavigationRequest( |
38 int64 frame_tree_node_id) | 44 int64 frame_tree_node_id, |
39 : navigation_request_id_(++next_navigation_request_id_), | 45 const CoreNavigationParams& core_params, |
40 info_(info), | 46 const CommitNavigationParams& commit_params) |
41 frame_tree_node_id_(frame_tree_node_id) { | 47 : navigation_request_id_(++next_navigation_request_id_), |
48 frame_tree_node_id_(frame_tree_node_id), | |
49 core_params_(core_params), | |
50 commit_params_(commit_params) { | |
42 } | 51 } |
43 | 52 |
44 NavigationRequest::~NavigationRequest() { | 53 NavigationRequest::~NavigationRequest() { |
45 } | 54 } |
46 | 55 |
47 void NavigationRequest::BeginNavigation( | 56 void NavigationRequest::BeginNavigation( |
57 scoped_ptr<NavigationRequestInfo> info, | |
48 scoped_refptr<ResourceRequestBody> request_body) { | 58 scoped_refptr<ResourceRequestBody> request_body) { |
59 info_ = info.Pass(); | |
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
50 BrowserThread::PostTask( | 61 BrowserThread::PostTask( |
51 BrowserThread::IO, | 62 BrowserThread::IO, |
52 FROM_HERE, | 63 FROM_HERE, |
53 base::Bind(&OnBeginNavigation, | 64 base::Bind(&OnBeginNavigation, |
54 info_, | 65 core_params_, |
66 *info_, | |
nasko
2014/09/26 22:16:43
Are we sure that this NavigationRequest will outli
clamy
2014/09/29 20:45:30
We are making a copy of info and passing it to the
nasko
2014/09/29 22:12:11
Should it be prefixed/suffixed with test marker th
clamy
2014/09/29 23:12:11
I have renamed the getter info_for_test(), which s
| |
55 request_body, | 67 request_body, |
56 navigation_request_id_, | 68 navigation_request_id_, |
57 frame_tree_node_id_)); | 69 frame_tree_node_id_)); |
58 } | 70 } |
59 | 71 |
60 void NavigationRequest::CancelNavigation() { | 72 void NavigationRequest::CancelNavigation() { |
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
62 BrowserThread::PostTask( | 74 BrowserThread::PostTask( |
63 BrowserThread::IO, | 75 BrowserThread::IO, |
64 FROM_HERE, | 76 FROM_HERE, |
65 base::Bind(&CancelNavigationRequest, | 77 base::Bind(&CancelNavigationRequest, |
66 navigation_request_id_, frame_tree_node_id_)); | 78 navigation_request_id_, frame_tree_node_id_)); |
67 } | 79 } |
68 | 80 |
69 } // namespace content | 81 } // namespace content |
OLD | NEW |