| 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 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
| 7 | 7 |
| 8 #include "base/supports_user_data.h" |
| 8 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 9 #include "content/public/browser/navigation_throttle.h" | 10 #include "content/public/browser/navigation_throttle.h" |
| 10 #include "content/public/common/referrer.h" | 11 #include "content/public/common/referrer.h" |
| 11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 12 #include "ui/base/page_transition_types.h" | 13 #include "ui/base/page_transition_types.h" |
| 13 | 14 |
| 14 class GURL; | 15 class GURL; |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 18 class NavigationUserData; |
| 17 class NavigationThrottle; | 19 class NavigationThrottle; |
| 18 class RenderFrameHost; | 20 class RenderFrameHost; |
| 19 class WebContents; | 21 class WebContents; |
| 20 | 22 |
| 21 // A NavigationHandle tracks information related to a single navigation. | 23 // A NavigationHandle tracks information related to a single navigation. |
| 22 // NavigationHandles are provided to several WebContentsObserver methods to | 24 // NavigationHandles are provided to several WebContentsObserver methods to |
| 23 // allow observers to track specific navigations. Observers should clear any | 25 // allow observers to track specific navigations. Observers should clear any |
| 24 // references to a NavigationHandle at the time of | 26 // references to a NavigationHandle at the time of |
| 25 // WebContentsObserver::DidFinishNavigation, just before the handle is | 27 // WebContentsObserver::DidFinishNavigation, just before the handle is |
| 26 // destroyed. | 28 // destroyed. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 129 |
| 128 // Resumes a navigation that was previously deferred by a NavigationThrottle. | 130 // Resumes a navigation that was previously deferred by a NavigationThrottle. |
| 129 virtual void Resume() = 0; | 131 virtual void Resume() = 0; |
| 130 | 132 |
| 131 // Cancels a navigation that was previously deferred by a NavigationThrottle. | 133 // Cancels a navigation that was previously deferred by a NavigationThrottle. |
| 132 // |result| should be equal to NavigationThrottle::CANCEL or | 134 // |result| should be equal to NavigationThrottle::CANCEL or |
| 133 // NavigationThrottle::CANCEL_AND_IGNORE. | 135 // NavigationThrottle::CANCEL_AND_IGNORE. |
| 134 virtual void CancelDeferredNavigation( | 136 virtual void CancelDeferredNavigation( |
| 135 NavigationThrottle::ThrottleCheckResult result) = 0; | 137 NavigationThrottle::ThrottleCheckResult result) = 0; |
| 136 | 138 |
| 139 virtual base::SupportsUserData::Data* GetUserData(const void* key) = 0; |
| 140 |
| 137 // Testing methods ---------------------------------------------------------- | 141 // Testing methods ---------------------------------------------------------- |
| 138 // | 142 // |
| 139 // The following methods should be used exclusively for writing unit tests. | 143 // The following methods should be used exclusively for writing unit tests. |
| 140 | 144 |
| 141 static scoped_ptr<NavigationHandle> CreateNavigationHandleForTesting( | 145 static scoped_ptr<NavigationHandle> CreateNavigationHandleForTesting( |
| 142 const GURL& url, | 146 const GURL& url, |
| 143 RenderFrameHost* render_frame_host); | 147 RenderFrameHost* render_frame_host); |
| 144 | 148 |
| 145 // Registers a NavigationThrottle for tests. The throttle can | 149 // Registers a NavigationThrottle for tests. The throttle can |
| 146 // modify the request, pause the request or cancel the request. This will | 150 // modify the request, pause the request or cancel the request. This will |
| (...skipping 17 matching lines...) Expand all Loading... |
| 164 virtual NavigationThrottle::ThrottleCheckResult | 168 virtual NavigationThrottle::ThrottleCheckResult |
| 165 CallWillRedirectRequestForTesting(const GURL& new_url, | 169 CallWillRedirectRequestForTesting(const GURL& new_url, |
| 166 bool new_method_is_post, | 170 bool new_method_is_post, |
| 167 const GURL& new_referrer_url, | 171 const GURL& new_referrer_url, |
| 168 bool new_is_external_protocol) = 0; | 172 bool new_is_external_protocol) = 0; |
| 169 }; | 173 }; |
| 170 | 174 |
| 171 } // namespace content | 175 } // namespace content |
| 172 | 176 |
| 173 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 177 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
| OLD | NEW |