Chromium Code Reviews| Index: content/browser/frame_host/navigation_handle_impl.h |
| diff --git a/content/browser/frame_host/navigation_handle_impl.h b/content/browser/frame_host/navigation_handle_impl.h |
| index 33e51ddab278cf281b89fe998d32159acc2210b0..7e2f4889468dd563c022c42b5d34e868984865f6 100644 |
| --- a/content/browser/frame_host/navigation_handle_impl.h |
| +++ b/content/browser/frame_host/navigation_handle_impl.h |
| @@ -9,7 +9,9 @@ |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| #include "content/common/content_export.h" |
| +#include "content/public/browser/navigation_throttle.h" |
| #include "url/gurl.h" |
| namespace content { |
| @@ -52,7 +54,12 @@ struct NavigationRequestInfo; |
| // the RenderFrameHost still apply. |
| class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| public: |
| + // This is used by the NavigationHandleFactory to create NavigationHandles |
| + // in the regular case. Other callers should use |
| + // NavigationHandleFactory::Create, which will ensure that test versions of |
| + // NavigationHandles are properly created in unit tests. |
|
nasko
2015/09/04 00:01:52
Why not make this method private then? If it is no
clamy
2015/09/04 12:59:14
Ha I wasn't sure about making non-test classes fri
clamy
2015/09/08 16:27:18
I removed it entirely, and have NavigationHandleFa
|
| static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, |
| + const GURL& validated_url, |
| const bool is_main_frame, |
| NavigatorDelegate* delegate); |
| @@ -60,10 +67,18 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| // NavigationHandle implementation: |
| const GURL& GetURL() const override; |
| - net::Error GetNetErrorCode() const override; |
| + const GURL& GetValidatedURL() const override; |
| bool IsInMainFrame() const override; |
| + bool IsPost() const override; |
| + const Referrer& GetReferrer() const override; |
| + bool HasUserGesture() const override; |
| + ui::PageTransition GetPageTransition() const override; |
| + bool IsExternalProtocol() const override; |
| + net::Error GetNetErrorCode() const override; |
| bool HasCommittedDocument() const override; |
| bool HasCommittedErrorPage() const override; |
| + void RegisterThrottleForTesting( |
| + scoped_ptr<NavigationThrottle> navigation_throttle) override; |
| void set_net_error_code(net::Error net_error_code) { |
| net_error_code_ = net_error_code; |
| @@ -78,6 +93,22 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| is_transferring_ = is_transferring; |
| } |
| + // Called when the URLRequest will start in the network stack. |
| + NavigationThrottle::ThrottleCheckResult WillStartRequest( |
| + bool is_post, |
| + const Referrer& sanitized_referrer, |
| + bool has_user_gesture, |
| + ui::PageTransition transition, |
| + bool is_external_protocol); |
| + |
| + // Called when the URLRequest will be redirected in the network stack. |
| + NavigationThrottle::ThrottleCheckResult WillRedirectRequest( |
| + const GURL& new_url, |
| + const GURL& new_validated_url, |
| + bool new_method_is_post, |
| + const GURL& new_referrer_url, |
| + bool new_is_external_protocol); |
| + |
| // Called when the navigation was redirected. This will update the |url_| and |
| // inform the delegate. |
| void DidRedirectNavigation(const GURL& new_url); |
| @@ -87,22 +118,34 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| void DidCommitNavigation(); |
| private: |
| + friend class TestNavigationHandle; |
| + |
| // Used to track the state the navigation is currently in. |
| enum State { |
| DID_START = 0, |
| + WILL_SEND_REQUEST, |
| DID_COMMIT, |
| DID_COMMIT_ERROR_PAGE, |
| }; |
| NavigationHandleImpl(const GURL& url, |
| + const GURL& validated_url, |
| const bool is_main_frame, |
| NavigatorDelegate* delegate); |
| // See NavigationHandle for a description of those member variables. |
| GURL url_; |
| + GURL validated_url_; |
| + const bool is_main_frame_; |
| + bool is_post_; |
| + Referrer sanitized_referrer_; |
| + bool has_user_gesture_; |
| + ui::PageTransition transition_; |
| + bool is_external_protocol_; |
| net::Error net_error_code_; |
| + |
| + // The state the navigation is in. |
| State state_; |
| - const bool is_main_frame_; |
| // Whether the navigation is in the middle of a transfer. Set to false when |
| // the DidStartProvisionalLoad is received from the new renderer. |
| @@ -112,6 +155,9 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| // navigation. |
| NavigatorDelegate* delegate_; |
| + // A list of Throttles registered for this navigation. |
| + ScopedVector<NavigationThrottle> throttles_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| }; |