Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ios/web/web_state/navigation_context_impl.mm

Issue 2835463002: Store NavigationIntext in CRWWKNavigationStates. (Closed)
Patch Set: Fixed compilation. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
8
7 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
8 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
9 11
10 namespace web { 12 namespace web {
11 13
12 // static 14 // static
13 std::unique_ptr<NavigationContext> 15 std::unique_ptr<NavigationContextImpl>
14 NavigationContextImpl::CreateNavigationContext( 16 NavigationContextImpl::CreateNavigationContext(
15 WebState* web_state, 17 WebState* web_state,
16 const GURL& url, 18 const GURL& url,
17 const scoped_refptr<net::HttpResponseHeaders>& response_headers) { 19 const scoped_refptr<net::HttpResponseHeaders>& response_headers) {
18 std::unique_ptr<NavigationContext> resut( 20 std::unique_ptr<NavigationContextImpl> resut(
19 new NavigationContextImpl(web_state, url, false /* is_same_document */, 21 new NavigationContextImpl(web_state, url, false /* is_same_document */,
20 false /* is_error_page */, response_headers)); 22 false /* is_error_page */, response_headers));
21 return resut; 23 return resut;
22 } 24 }
23 25
24 // static 26 // static
25 std::unique_ptr<NavigationContext> 27 std::unique_ptr<NavigationContextImpl>
26 NavigationContextImpl::CreateSameDocumentNavigationContext(WebState* web_state, 28 NavigationContextImpl::CreateSameDocumentNavigationContext(WebState* web_state,
27 const GURL& url) { 29 const GURL& url) {
28 std::unique_ptr<NavigationContext> result(new NavigationContextImpl( 30 std::unique_ptr<NavigationContextImpl> result(new NavigationContextImpl(
29 web_state, url, true /* is_same_document */, false /* is_error_page */, 31 web_state, url, true /* is_same_document */, false /* is_error_page */,
30 nullptr /* response_headers */)); 32 nullptr /* response_headers */));
31 return result; 33 return result;
32 } 34 }
33 35
34 // static 36 // static
35 std::unique_ptr<NavigationContext> 37 std::unique_ptr<NavigationContextImpl>
36 NavigationContextImpl::CreateErrorPageNavigationContext( 38 NavigationContextImpl::CreateErrorPageNavigationContext(
37 WebState* web_state, 39 WebState* web_state,
38 const GURL& url, 40 const GURL& url,
39 const scoped_refptr<net::HttpResponseHeaders>& response_headers) { 41 const scoped_refptr<net::HttpResponseHeaders>& response_headers) {
40 std::unique_ptr<NavigationContext> result( 42 std::unique_ptr<NavigationContextImpl> result(
41 new NavigationContextImpl(web_state, url, false /* is_same_document */, 43 new NavigationContextImpl(web_state, url, false /* is_same_document */,
42 true /* is_error_page */, response_headers)); 44 true /* is_error_page */, response_headers));
43 return result; 45 return result;
44 } 46 }
45 47
48 #ifndef NDEBUG
49 NSString* NavigationContextImpl::GetDescription() const {
50 return [NSString stringWithFormat:@"web::WebState: %ld, url: %s, "
51 "is_same_document: %@, is_error_page_: %@",
52 reinterpret_cast<long>(web_state_),
53 url_.spec().c_str(),
54 is_same_document_ ? @"true" : @"false",
55 is_error_page_ ? @"true" : @"false"];
56 }
57 #endif // NDEBUG
58
46 WebState* NavigationContextImpl::GetWebState() { 59 WebState* NavigationContextImpl::GetWebState() {
47 return web_state_; 60 return web_state_;
48 } 61 }
49 62
50 const GURL& NavigationContextImpl::GetUrl() const { 63 const GURL& NavigationContextImpl::GetUrl() const {
51 return url_; 64 return url_;
52 } 65 }
53 66
54 bool NavigationContextImpl::IsSameDocument() const { 67 bool NavigationContextImpl::IsSameDocument() const {
55 return is_same_document_; 68 return is_same_document_;
(...skipping 15 matching lines...) Expand all
71 const scoped_refptr<net::HttpResponseHeaders>& response_headers) 84 const scoped_refptr<net::HttpResponseHeaders>& response_headers)
72 : web_state_(web_state), 85 : web_state_(web_state),
73 url_(url), 86 url_(url),
74 is_same_document_(is_same_document), 87 is_same_document_(is_same_document),
75 is_error_page_(is_error_page), 88 is_error_page_(is_error_page),
76 response_headers_(response_headers) {} 89 response_headers_(response_headers) {}
77 90
78 NavigationContextImpl::~NavigationContextImpl() = default; 91 NavigationContextImpl::~NavigationContextImpl() = default;
79 92
80 } // namespace web 93 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_context_impl.h ('k') | ios/web/web_state/ui/crw_wk_navigation_states.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698