| 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 #include "ios/web/web_state/navigation_context_impl.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 |
| 9 namespace web { |
| 10 |
| 11 // static |
| 12 std::unique_ptr<NavigationContext> |
| 13 NavigationContextImpl::CreateNavigationContext(WebState* web_state, |
| 14 const GURL& url) { |
| 15 std::unique_ptr<NavigationContext> resut(new NavigationContextImpl( |
| 16 web_state, url, false /* is_same_page */, false /* is_error_page */)); |
| 17 return resut; |
| 18 } |
| 19 |
| 20 // static |
| 21 std::unique_ptr<NavigationContext> |
| 22 NavigationContextImpl::CreateSamePageNavigationContext(WebState* web_state, |
| 23 const GURL& url) { |
| 24 std::unique_ptr<NavigationContext> result(new NavigationContextImpl( |
| 25 web_state, url, true /* is_same_page */, false /* is_error_page */)); |
| 26 return result; |
| 27 } |
| 28 |
| 29 // static |
| 30 std::unique_ptr<NavigationContext> |
| 31 NavigationContextImpl::CreateErrorPageNavigationContext(WebState* web_state, |
| 32 const GURL& url) { |
| 33 std::unique_ptr<NavigationContext> result(new NavigationContextImpl( |
| 34 web_state, url, false /* is_same_page */, true /* is_error_page */)); |
| 35 return result; |
| 36 } |
| 37 |
| 38 WebState* NavigationContextImpl::GetWebState() { |
| 39 return web_state_; |
| 40 } |
| 41 |
| 42 const GURL& NavigationContextImpl::GetUrl() const { |
| 43 return url_; |
| 44 } |
| 45 |
| 46 bool NavigationContextImpl::IsSamePage() const { |
| 47 return is_same_page_; |
| 48 } |
| 49 |
| 50 bool NavigationContextImpl::IsErrorPage() const { |
| 51 return is_error_page_; |
| 52 } |
| 53 |
| 54 NavigationContextImpl::NavigationContextImpl(WebState* web_state, |
| 55 const GURL& url, |
| 56 bool is_same_page, |
| 57 bool is_error_page) |
| 58 : web_state_(web_state), |
| 59 url_(url), |
| 60 is_same_page_(is_same_page), |
| 61 is_error_page_(is_error_page) {} |
| 62 |
| 63 NavigationContextImpl::~NavigationContextImpl() = default; |
| 64 |
| 65 } // namespace web |
| OLD | NEW |