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

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

Issue 2896623003: Added web::NavigationContext::GetPageTransition. (Closed)
Patch Set: Fixed condition for SetIsCreatedFromHashChange call 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> 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, 16 NavigationContextImpl::CreateNavigationContext(
17 const GURL& url) { 17 WebState* web_state,
18 const GURL& url,
19 ui::PageTransition page_transition) {
18 std::unique_ptr<NavigationContextImpl> result(new NavigationContextImpl( 20 std::unique_ptr<NavigationContextImpl> result(new NavigationContextImpl(
19 web_state, url, false /* is_same_document */, false /* is_error_page */, 21 web_state, url, page_transition, false /* is_same_document */,
20 nullptr /* response_headers */)); 22 false /* is_error_page */, nullptr /* response_headers */));
21 return result; 23 return result;
22 } 24 }
23 25
24 #ifndef NDEBUG 26 #ifndef NDEBUG
25 NSString* NavigationContextImpl::GetDescription() const { 27 NSString* NavigationContextImpl::GetDescription() const {
26 return [NSString stringWithFormat:@"web::WebState: %ld, url: %s, " 28 return [NSString stringWithFormat:@"web::WebState: %ld, url: %s, "
27 "is_same_document: %@, is_error_page_: %@", 29 "is_same_document: %@, is_error_page_: %@",
28 reinterpret_cast<long>(web_state_), 30 reinterpret_cast<long>(web_state_),
29 url_.spec().c_str(), 31 url_.spec().c_str(),
30 is_same_document_ ? @"true" : @"false", 32 is_same_document_ ? @"true" : @"false",
31 is_error_page_ ? @"true" : @"false"]; 33 is_error_page_ ? @"true" : @"false"];
32 } 34 }
33 #endif // NDEBUG 35 #endif // NDEBUG
34 36
35 WebState* NavigationContextImpl::GetWebState() { 37 WebState* NavigationContextImpl::GetWebState() {
36 return web_state_; 38 return web_state_;
37 } 39 }
38 40
39 const GURL& NavigationContextImpl::GetUrl() const { 41 const GURL& NavigationContextImpl::GetUrl() const {
40 return url_; 42 return url_;
41 } 43 }
42 44
45 ui::PageTransition NavigationContextImpl::GetPageTransition() const {
46 return page_transition_;
47 }
48
43 bool NavigationContextImpl::IsSameDocument() const { 49 bool NavigationContextImpl::IsSameDocument() const {
44 return is_same_document_; 50 return is_same_document_;
45 } 51 }
46 52
47 bool NavigationContextImpl::IsErrorPage() const { 53 bool NavigationContextImpl::IsErrorPage() const {
48 return is_error_page_; 54 return is_error_page_;
49 } 55 }
50 56
51 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const { 57 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const {
52 return response_headers_.get(); 58 return response_headers_.get();
(...skipping 16 matching lines...) Expand all
69 return navigation_item_unique_id_; 75 return navigation_item_unique_id_;
70 } 76 }
71 77
72 void NavigationContextImpl::SetNavigationItemUniqueID(int unique_id) { 78 void NavigationContextImpl::SetNavigationItemUniqueID(int unique_id) {
73 navigation_item_unique_id_ = unique_id; 79 navigation_item_unique_id_ = unique_id;
74 } 80 }
75 81
76 NavigationContextImpl::NavigationContextImpl( 82 NavigationContextImpl::NavigationContextImpl(
77 WebState* web_state, 83 WebState* web_state,
78 const GURL& url, 84 const GURL& url,
85 ui::PageTransition page_transition,
79 bool is_same_document, 86 bool is_same_document,
80 bool is_error_page, 87 bool is_error_page,
81 const scoped_refptr<net::HttpResponseHeaders>& response_headers) 88 const scoped_refptr<net::HttpResponseHeaders>& response_headers)
82 : web_state_(web_state), 89 : web_state_(web_state),
83 url_(url), 90 url_(url),
91 page_transition_(page_transition),
84 is_same_document_(is_same_document), 92 is_same_document_(is_same_document),
85 is_error_page_(is_error_page), 93 is_error_page_(is_error_page),
86 response_headers_(response_headers) {} 94 response_headers_(response_headers) {}
87 95
88 NavigationContextImpl::~NavigationContextImpl() = default; 96 NavigationContextImpl::~NavigationContextImpl() = default;
89 97
90 } // namespace web 98 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698