| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ | 6 #define IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ |
| 7 | 7 |
| 8 class GURL; | 8 class GURL; |
| 9 | 9 |
| 10 namespace web { | 10 namespace web { |
| 11 | 11 |
| 12 class WebState; | 12 class WebState; |
| 13 | 13 |
| 14 // Tracks information related to a single navigation. A NavigationContext is | 14 // Tracks information related to a single navigation. A NavigationContext is |
| 15 // provided to WebStateObserver methods to allow observers to track specific | 15 // provided to WebStateObserver methods to allow observers to track specific |
| 16 // navigations and their details. Observers should clear any references to a | 16 // navigations and their details. Observers should clear any references to a |
| 17 // NavigationContext at the time of WebStateObserver::DidFinishNavigation, just | 17 // NavigationContext at the time of WebStateObserver::DidFinishNavigation, just |
| 18 // before the handle is destroyed. | 18 // before the handle is destroyed. |
| 19 class NavigationContext { | 19 class NavigationContext { |
| 20 public: | 20 public: |
| 21 // The WebState the navigation is taking place in. | 21 // The WebState the navigation is taking place in. |
| 22 virtual WebState* GetWebState() = 0; | 22 virtual WebState* GetWebState() = 0; |
| 23 | 23 |
| 24 // The URL the WebState is navigating to. | 24 // The URL the WebState is navigating to. |
| 25 virtual const GURL& GetUrl() const = 0; | 25 virtual const GURL& GetUrl() const = 0; |
| 26 | 26 |
| 27 // Whether the navigation happened in the same page. Examples of same page | 27 // Whether the navigation happened within the same document. Examples of same |
| 28 // navigations are: | 28 // document navigations are: |
| 29 // * reference fragment navigations | 29 // * reference fragment navigations |
| 30 // * pushState/replaceState | 30 // * pushState/replaceState |
| 31 // * same page history navigation | 31 // * same document history navigation |
| 32 virtual bool IsSamePage() const = 0; | 32 virtual bool IsSameDocument() const = 0; |
| 33 | 33 |
| 34 // Whether the navigation resulted in an error page. | 34 // Whether the navigation resulted in an error page. |
| 35 virtual bool IsErrorPage() const = 0; | 35 virtual bool IsErrorPage() const = 0; |
| 36 | 36 |
| 37 virtual ~NavigationContext() {} | 37 virtual ~NavigationContext() {} |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace web | 40 } // namespace web |
| 41 | 41 |
| 42 #endif // IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ | 42 #endif // IOS_WEB_PUBLIC_WEB_STATE_NAVIGATION_CONTEXT_H_ |
| OLD | NEW |