OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
11 #include "content/browser/frame_host/navigator_delegate.h" | 11 #include "content/browser/frame_host/navigator_delegate.h" |
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
13 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 13 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
14 #include "content/common/frame_messages.h" | 14 #include "content/common/frame_messages.h" |
15 #include "content/public/browser/content_browser_client.h" | 15 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/browser/navigation_entry.h" | |
16 #include "content/public/common/browser_side_navigation_policy.h" | 17 #include "content/public/common/browser_side_navigation_policy.h" |
17 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
18 #include "net/url_request/redirect_info.h" | 19 #include "net/url_request/redirect_info.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 void UpdateThrottleCheckResult( | 25 void UpdateThrottleCheckResult( |
25 NavigationThrottle::ThrottleCheckResult* to_update, | 26 NavigationThrottle::ThrottleCheckResult* to_update, |
26 NavigationThrottle::ThrottleCheckResult result) { | 27 NavigationThrottle::ThrottleCheckResult result) { |
27 *to_update = result; | 28 *to_update = result; |
28 } | 29 } |
29 | 30 |
30 } // namespace | 31 } // namespace |
31 | 32 |
32 // static | 33 // static |
33 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( | 34 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( |
34 const GURL& url, | 35 const GURL& url, |
35 FrameTreeNode* frame_tree_node, | 36 FrameTreeNode* frame_tree_node, |
36 const base::TimeTicks& navigation_start) { | 37 const base::TimeTicks& navigation_start, |
37 return scoped_ptr<NavigationHandleImpl>( | 38 NavigationEntry* navigation_entry) { |
38 new NavigationHandleImpl(url, frame_tree_node, navigation_start)); | 39 return scoped_ptr<NavigationHandleImpl>(new NavigationHandleImpl( |
40 url, frame_tree_node, navigation_start, navigation_entry)); | |
39 } | 41 } |
40 | 42 |
41 NavigationHandleImpl::NavigationHandleImpl( | 43 NavigationHandleImpl::NavigationHandleImpl( |
42 const GURL& url, | 44 const GURL& url, |
43 FrameTreeNode* frame_tree_node, | 45 FrameTreeNode* frame_tree_node, |
44 const base::TimeTicks& navigation_start) | 46 const base::TimeTicks& navigation_start, |
47 NavigationEntry* navigation_entry) | |
Charlie Reis
2016/02/05 19:36:11
If we're only using the NavEntry's ID, maybe we sh
Charlie Harrison
2016/02/05 23:10:23
My argument would be that there now *is* a real de
Charlie Reis
2016/02/06 00:54:57
I see your point, but I feel like this tempts us t
| |
45 : url_(url), | 48 : url_(url), |
46 is_post_(false), | 49 is_post_(false), |
47 has_user_gesture_(false), | 50 has_user_gesture_(false), |
48 transition_(ui::PAGE_TRANSITION_LINK), | 51 transition_(ui::PAGE_TRANSITION_LINK), |
49 is_external_protocol_(false), | 52 is_external_protocol_(false), |
50 net_error_code_(net::OK), | 53 net_error_code_(net::OK), |
51 render_frame_host_(nullptr), | 54 render_frame_host_(nullptr), |
52 is_same_page_(false), | 55 is_same_page_(false), |
53 state_(INITIAL), | 56 state_(INITIAL), |
54 is_transferring_(false), | 57 is_transferring_(false), |
55 frame_tree_node_(frame_tree_node), | 58 frame_tree_node_(frame_tree_node), |
56 next_index_(0), | 59 next_index_(0), |
57 navigation_start_(navigation_start) { | 60 navigation_start_(navigation_start), |
61 entry_id_(navigation_entry ? navigation_entry->GetUniqueID() : -1) { | |
Charlie Reis
2016/02/05 19:36:11
nit: We use 0 for none (as in RenderFrameHostImpl:
Charlie Harrison
2016/02/05 23:10:23
Done.
| |
58 DCHECK(!navigation_start.is_null()); | 62 DCHECK(!navigation_start.is_null()); |
59 GetDelegate()->DidStartNavigation(this); | 63 GetDelegate()->DidStartNavigation(this); |
60 } | 64 } |
61 | 65 |
62 NavigationHandleImpl::~NavigationHandleImpl() { | 66 NavigationHandleImpl::~NavigationHandleImpl() { |
63 GetDelegate()->DidFinishNavigation(this); | 67 GetDelegate()->DidFinishNavigation(this); |
64 | 68 |
65 // Cancel the navigation on the IO thread if the NavigationHandle is being | 69 // Cancel the navigation on the IO thread if the NavigationHandle is being |
66 // destroyed in the middle of the NavigationThrottles checks. | 70 // destroyed in the middle of the NavigationThrottles checks. |
67 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) | 71 if (!IsBrowserSideNavigationEnabled() && !complete_callback_.is_null()) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 void NavigationHandleImpl::RunCompleteCallback( | 385 void NavigationHandleImpl::RunCompleteCallback( |
382 NavigationThrottle::ThrottleCheckResult result) { | 386 NavigationThrottle::ThrottleCheckResult result) { |
383 DCHECK(result != NavigationThrottle::DEFER); | 387 DCHECK(result != NavigationThrottle::DEFER); |
384 if (!complete_callback_.is_null()) | 388 if (!complete_callback_.is_null()) |
385 complete_callback_.Run(result); | 389 complete_callback_.Run(result); |
386 | 390 |
387 complete_callback_.Reset(); | 391 complete_callback_.Reset(); |
388 } | 392 } |
389 | 393 |
390 } // namespace content | 394 } // namespace content |
OLD | NEW |