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