| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ |
| 6 #define IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "ios/web/public/web_state/navigation_context.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace web { |
| 15 |
| 16 // Tracks information related to a single navigation. |
| 17 class NavigationContextImpl : public NavigationContext { |
| 18 public: |
| 19 // Creates navigation context for sucessful navigation to a different page. |
| 20 static std::unique_ptr<NavigationContext> CreateNavigationContext( |
| 21 WebState* web_state, |
| 22 const GURL& url); |
| 23 |
| 24 // Creates navigation context for sucessful same page navigation. |
| 25 static std::unique_ptr<NavigationContext> CreateSamePageNavigationContext( |
| 26 WebState* web_state, |
| 27 const GURL& url); |
| 28 |
| 29 // Creates navigation context for the error page navigation. |
| 30 static std::unique_ptr<NavigationContext> CreateErrorPageNavigationContext( |
| 31 WebState* web_state, |
| 32 const GURL& url); |
| 33 |
| 34 // NavigationContext overrides: |
| 35 WebState* GetWebState() override; |
| 36 const GURL& GetUrl() const override; |
| 37 bool IsSamePage() const override; |
| 38 bool IsErrorPage() const override; |
| 39 |
| 40 private: |
| 41 NavigationContextImpl(WebState* web_state, |
| 42 const GURL& url, |
| 43 bool is_same_page, |
| 44 bool is_error_page); |
| 45 ~NavigationContextImpl() override; |
| 46 |
| 47 WebState* web_state_ = nullptr; |
| 48 GURL url_; |
| 49 bool is_same_page_ = false; |
| 50 bool is_error_page_ = false; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl); |
| 53 }; |
| 54 |
| 55 } // namespace web |
| 56 |
| 57 #endif // IOS_WEB_WEB_STATE_NAVIGATION_CONTEXT_IMPL_H_ |
| OLD | NEW |