| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/browser/frame_host/frame_tree_node.h" | 8 #include "content/browser/frame_host/frame_tree_node.h" |
| 9 #include "content/browser/frame_host/navigator.h" | 9 #include "content/browser/frame_host/navigator.h" |
| 10 #include "content/browser/frame_host/navigator_delegate.h" | 10 #include "content/browser/frame_host/navigator_delegate.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 NavigationThrottle::ThrottleCheckResult* to_update, | 26 NavigationThrottle::ThrottleCheckResult* to_update, |
| 27 NavigationThrottle::ThrottleCheckResult result) { | 27 NavigationThrottle::ThrottleCheckResult result) { |
| 28 *to_update = result; | 28 *to_update = result; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( | 34 scoped_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( |
| 35 const GURL& url, | 35 const GURL& url, |
| 36 FrameTreeNode* frame_tree_node) { | 36 FrameTreeNode* frame_tree_node, |
| 37 const base::TimeTicks& navigation_start) { |
| 37 return scoped_ptr<NavigationHandleImpl>( | 38 return scoped_ptr<NavigationHandleImpl>( |
| 38 new NavigationHandleImpl(url, frame_tree_node)); | 39 new NavigationHandleImpl(url, frame_tree_node, navigation_start)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 NavigationHandleImpl::NavigationHandleImpl(const GURL& url, | 42 NavigationHandleImpl::NavigationHandleImpl( |
| 42 FrameTreeNode* frame_tree_node) | 43 const GURL& url, |
| 44 FrameTreeNode* frame_tree_node, |
| 45 const base::TimeTicks& navigation_start) |
| 43 : url_(url), | 46 : url_(url), |
| 44 is_post_(false), | 47 is_post_(false), |
| 45 has_user_gesture_(false), | 48 has_user_gesture_(false), |
| 46 transition_(ui::PAGE_TRANSITION_LINK), | 49 transition_(ui::PAGE_TRANSITION_LINK), |
| 47 is_external_protocol_(false), | 50 is_external_protocol_(false), |
| 48 net_error_code_(net::OK), | 51 net_error_code_(net::OK), |
| 49 render_frame_host_(nullptr), | 52 render_frame_host_(nullptr), |
| 50 is_same_page_(false), | 53 is_same_page_(false), |
| 51 state_(INITIAL), | 54 state_(INITIAL), |
| 52 is_transferring_(false), | 55 is_transferring_(false), |
| 53 frame_tree_node_(frame_tree_node), | 56 frame_tree_node_(frame_tree_node), |
| 54 next_index_(0) { | 57 next_index_(0), |
| 58 navigation_start_(navigation_start) { |
| 59 DCHECK(!navigation_start.is_null()); |
| 55 // PlzNavigate | 60 // PlzNavigate |
| 56 // Initialize the ServiceWorkerNavigationHandle if it can be created for this | 61 // Initialize the ServiceWorkerNavigationHandle if it can be created for this |
| 57 // frame. | 62 // frame. |
| 58 bool can_create_service_worker = | 63 bool can_create_service_worker = |
| 59 (frame_tree_node_->current_replication_state().sandbox_flags & | 64 (frame_tree_node_->current_replication_state().sandbox_flags & |
| 60 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; | 65 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; |
| 61 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 66 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 62 switches::kEnableBrowserSideNavigation) && | 67 switches::kEnableBrowserSideNavigation) && |
| 63 can_create_service_worker) { | 68 can_create_service_worker) { |
| 64 BrowserContext* browser_context = | 69 BrowserContext* browser_context = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 87 } | 92 } |
| 88 | 93 |
| 89 const GURL& NavigationHandleImpl::GetURL() { | 94 const GURL& NavigationHandleImpl::GetURL() { |
| 90 return url_; | 95 return url_; |
| 91 } | 96 } |
| 92 | 97 |
| 93 bool NavigationHandleImpl::IsInMainFrame() { | 98 bool NavigationHandleImpl::IsInMainFrame() { |
| 94 return frame_tree_node_->IsMainFrame(); | 99 return frame_tree_node_->IsMainFrame(); |
| 95 } | 100 } |
| 96 | 101 |
| 102 const base::TimeTicks& NavigationHandleImpl::GetNavigationStart() { |
| 103 return navigation_start_; |
| 104 } |
| 105 |
| 97 bool NavigationHandleImpl::IsPost() { | 106 bool NavigationHandleImpl::IsPost() { |
| 98 CHECK_NE(INITIAL, state_) | 107 CHECK_NE(INITIAL, state_) |
| 99 << "This accessor should not be called before the request is started."; | 108 << "This accessor should not be called before the request is started."; |
| 100 return is_post_; | 109 return is_post_; |
| 101 } | 110 } |
| 102 | 111 |
| 103 const Referrer& NavigationHandleImpl::GetReferrer() { | 112 const Referrer& NavigationHandleImpl::GetReferrer() { |
| 104 CHECK_NE(INITIAL, state_) | 113 CHECK_NE(INITIAL, state_) |
| 105 << "This accessor should not be called before the request is started."; | 114 << "This accessor should not be called before the request is started."; |
| 106 return sanitized_referrer_; | 115 return sanitized_referrer_; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 default: | 345 default: |
| 337 NOTREACHED(); | 346 NOTREACHED(); |
| 338 } | 347 } |
| 339 } | 348 } |
| 340 next_index_ = 0; | 349 next_index_ = 0; |
| 341 state_ = WILL_REDIRECT_REQUEST; | 350 state_ = WILL_REDIRECT_REQUEST; |
| 342 return NavigationThrottle::PROCEED; | 351 return NavigationThrottle::PROCEED; |
| 343 } | 352 } |
| 344 | 353 |
| 345 } // namespace content | 354 } // namespace content |
| OLD | NEW |