| 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 #include "ios/web/web_state/navigation_context_impl.h" | 5 #include "ios/web/web_state/navigation_context_impl.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 11 | 11 |
| 12 namespace web { | 12 namespace web { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 std::unique_ptr<NavigationContextImpl> | 15 std::unique_ptr<NavigationContextImpl> |
| 16 NavigationContextImpl::CreateNavigationContext(WebState* web_state, |
| 17 const GURL& url) { |
| 18 std::unique_ptr<NavigationContextImpl> result(new NavigationContextImpl( |
| 19 web_state, url, false /* is_same_document */, false /* is_error_page */, |
| 20 nullptr /* response_headers */)); |
| 21 return result; |
| 22 } |
| 23 |
| 24 // static |
| 25 std::unique_ptr<NavigationContextImpl> |
| 16 NavigationContextImpl::CreateNavigationContext( | 26 NavigationContextImpl::CreateNavigationContext( |
| 17 WebState* web_state, | 27 WebState* web_state, |
| 18 const GURL& url, | 28 const GURL& url, |
| 19 const scoped_refptr<net::HttpResponseHeaders>& response_headers) { | 29 const scoped_refptr<net::HttpResponseHeaders>& response_headers) { |
| 20 std::unique_ptr<NavigationContextImpl> resut( | 30 std::unique_ptr<NavigationContextImpl> resut( |
| 21 new NavigationContextImpl(web_state, url, false /* is_same_document */, | 31 new NavigationContextImpl(web_state, url, false /* is_same_document */, |
| 22 false /* is_error_page */, response_headers)); | 32 false /* is_error_page */, response_headers)); |
| 23 return resut; | 33 return resut; |
| 24 } | 34 } |
| 25 | 35 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 79 } |
| 70 | 80 |
| 71 bool NavigationContextImpl::IsErrorPage() const { | 81 bool NavigationContextImpl::IsErrorPage() const { |
| 72 return is_error_page_; | 82 return is_error_page_; |
| 73 } | 83 } |
| 74 | 84 |
| 75 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const { | 85 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const { |
| 76 return response_headers_.get(); | 86 return response_headers_.get(); |
| 77 } | 87 } |
| 78 | 88 |
| 89 void NavigationContextImpl::SetIsSameDocument(bool is_same_document) { |
| 90 is_same_document_ = is_same_document; |
| 91 } |
| 92 |
| 93 void NavigationContextImpl::SetIsErrorPage(bool is_error_page) { |
| 94 is_error_page_ = is_error_page; |
| 95 } |
| 96 |
| 97 void NavigationContextImpl::SetResponseHeaders( |
| 98 const scoped_refptr<net::HttpResponseHeaders>& response_headers) { |
| 99 response_headers_ = response_headers; |
| 100 } |
| 101 |
| 79 NavigationContextImpl::NavigationContextImpl( | 102 NavigationContextImpl::NavigationContextImpl( |
| 80 WebState* web_state, | 103 WebState* web_state, |
| 81 const GURL& url, | 104 const GURL& url, |
| 82 bool is_same_document, | 105 bool is_same_document, |
| 83 bool is_error_page, | 106 bool is_error_page, |
| 84 const scoped_refptr<net::HttpResponseHeaders>& response_headers) | 107 const scoped_refptr<net::HttpResponseHeaders>& response_headers) |
| 85 : web_state_(web_state), | 108 : web_state_(web_state), |
| 86 url_(url), | 109 url_(url), |
| 87 is_same_document_(is_same_document), | 110 is_same_document_(is_same_document), |
| 88 is_error_page_(is_error_page), | 111 is_error_page_(is_error_page), |
| 89 response_headers_(response_headers) {} | 112 response_headers_(response_headers) {} |
| 90 | 113 |
| 91 NavigationContextImpl::~NavigationContextImpl() = default; | 114 NavigationContextImpl::~NavigationContextImpl() = default; |
| 92 | 115 |
| 93 } // namespace web | 116 } // namespace web |
| OLD | NEW |