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