| 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 <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/navigation_throttle.h" | 12 #include "content/public/browser/navigation_throttle.h" |
| 12 #include "content/public/common/referrer.h" | 13 #include "content/public/common/referrer.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/http/http_response_info.h" | 15 #include "net/http/http_response_info.h" |
| 15 #include "ui/base/page_transition_types.h" | 16 #include "ui/base/page_transition_types.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class HttpResponseHeaders; | 21 class HttpResponseHeaders; |
| 21 } // namespace net | 22 } // namespace net |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 25 struct GlobalRequestID; |
| 24 class NavigationData; | 26 class NavigationData; |
| 25 class NavigationThrottle; | 27 class NavigationThrottle; |
| 26 class RenderFrameHost; | 28 class RenderFrameHost; |
| 27 class SiteInstance; | 29 class SiteInstance; |
| 28 class WebContents; | 30 class WebContents; |
| 29 | 31 |
| 30 // A NavigationHandle tracks information related to a single navigation. | 32 // A NavigationHandle tracks information related to a single navigation. |
| 31 // NavigationHandles are provided to several WebContentsObserver methods to | 33 // NavigationHandles are provided to several WebContentsObserver methods to |
| 32 // allow observers to track specific navigations. Observers should clear any | 34 // allow observers to track specific navigations. Observers should clear any |
| 33 // references to a NavigationHandle at the time of | 35 // references to a NavigationHandle at the time of |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 183 |
| 182 // Resumes a navigation that was previously deferred by a NavigationThrottle. | 184 // Resumes a navigation that was previously deferred by a NavigationThrottle. |
| 183 virtual void Resume() = 0; | 185 virtual void Resume() = 0; |
| 184 | 186 |
| 185 // Cancels a navigation that was previously deferred by a NavigationThrottle. | 187 // Cancels a navigation that was previously deferred by a NavigationThrottle. |
| 186 // |result| should be equal to NavigationThrottle::CANCEL or | 188 // |result| should be equal to NavigationThrottle::CANCEL or |
| 187 // NavigationThrottle::CANCEL_AND_IGNORE. | 189 // NavigationThrottle::CANCEL_AND_IGNORE. |
| 188 virtual void CancelDeferredNavigation( | 190 virtual void CancelDeferredNavigation( |
| 189 NavigationThrottle::ThrottleCheckResult result) = 0; | 191 NavigationThrottle::ThrottleCheckResult result) = 0; |
| 190 | 192 |
| 193 // Returns the ID of the URLRequest associated with this navigation. Can only |
| 194 // be called from NavigationThrottle::WillProcessResponse and |
| 195 // WebContentsObserver::ReadyToCommitNavigation. |
| 196 // In the case of transfer navigations, this is the ID of the first request |
| 197 // made. The transferred request's ID will not be tracked by the |
| 198 // NavigationHandle. |
| 199 virtual const GlobalRequestID& GetGlobalRequestID() = 0; |
| 200 |
| 191 // Testing methods ---------------------------------------------------------- | 201 // Testing methods ---------------------------------------------------------- |
| 192 // | 202 // |
| 193 // The following methods should be used exclusively for writing unit tests. | 203 // The following methods should be used exclusively for writing unit tests. |
| 194 | 204 |
| 195 static std::unique_ptr<NavigationHandle> CreateNavigationHandleForTesting( | 205 static std::unique_ptr<NavigationHandle> CreateNavigationHandleForTesting( |
| 196 const GURL& url, | 206 const GURL& url, |
| 197 RenderFrameHost* render_frame_host, | 207 RenderFrameHost* render_frame_host, |
| 198 bool committed = false, | 208 bool committed = false, |
| 199 net::Error error = net::OK); | 209 net::Error error = net::OK); |
| 200 | 210 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 244 |
| 235 // The NavigationData that the embedder returned from | 245 // The NavigationData that the embedder returned from |
| 236 // ResourceDispatcherHostDelegate::GetNavigationData during commit. This will | 246 // ResourceDispatcherHostDelegate::GetNavigationData during commit. This will |
| 237 // be a clone of the NavigationData. | 247 // be a clone of the NavigationData. |
| 238 virtual NavigationData* GetNavigationData() = 0; | 248 virtual NavigationData* GetNavigationData() = 0; |
| 239 }; | 249 }; |
| 240 | 250 |
| 241 } // namespace content | 251 } // namespace content |
| 242 | 252 |
| 243 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 253 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
| OLD | NEW |