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

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

Issue 2896623003: Added web::NavigationContext::GetPageTransition. (Closed)
Patch Set: Rebased 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 #import "ios/web/web_state/navigation_context_impl.h" 5 #import "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( 20 std::unique_ptr<NavigationContextImpl> result(
19 new NavigationContextImpl(web_state, url)); 21 new NavigationContextImpl(web_state, url, page_transition));
20 return result; 22 return result;
21 } 23 }
22 24
23 #ifndef NDEBUG 25 #ifndef NDEBUG
24 NSString* NavigationContextImpl::GetDescription() const { 26 NSString* NavigationContextImpl::GetDescription() const {
25 return [NSString 27 return [NSString
26 stringWithFormat:@"web::WebState: %ld, url: %s, " 28 stringWithFormat:@"web::WebState: %ld, url: %s, "
27 "is_same_document: %@, error: %@", 29 "is_same_document: %@, error: %@",
28 reinterpret_cast<long>(web_state_), url_.spec().c_str(), 30 reinterpret_cast<long>(web_state_), url_.spec().c_str(),
29 is_same_document_ ? @"true" : @"false", error_.get()]; 31 is_same_document_ ? @"true" : @"false", error_.get()];
30 } 32 }
31 #endif // NDEBUG 33 #endif // NDEBUG
32 34
33 WebState* NavigationContextImpl::GetWebState() { 35 WebState* NavigationContextImpl::GetWebState() {
34 return web_state_; 36 return web_state_;
35 } 37 }
36 38
37 const GURL& NavigationContextImpl::GetUrl() const { 39 const GURL& NavigationContextImpl::GetUrl() const {
38 return url_; 40 return url_;
39 } 41 }
40 42
43 ui::PageTransition NavigationContextImpl::GetPageTransition() const {
44 return page_transition_;
45 }
46
41 bool NavigationContextImpl::IsSameDocument() const { 47 bool NavigationContextImpl::IsSameDocument() const {
42 return is_same_document_; 48 return is_same_document_;
43 } 49 }
44 50
45 NSError* NavigationContextImpl::GetError() const { 51 NSError* NavigationContextImpl::GetError() const {
46 return error_; 52 return error_;
47 } 53 }
48 54
49 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const { 55 net::HttpResponseHeaders* NavigationContextImpl::GetResponseHeaders() const {
50 return response_headers_.get(); 56 return response_headers_.get();
(...skipping 14 matching lines...) Expand all
65 71
66 int NavigationContextImpl::GetNavigationItemUniqueID() const { 72 int NavigationContextImpl::GetNavigationItemUniqueID() const {
67 return navigation_item_unique_id_; 73 return navigation_item_unique_id_;
68 } 74 }
69 75
70 void NavigationContextImpl::SetNavigationItemUniqueID(int unique_id) { 76 void NavigationContextImpl::SetNavigationItemUniqueID(int unique_id) {
71 navigation_item_unique_id_ = unique_id; 77 navigation_item_unique_id_ = unique_id;
72 } 78 }
73 79
74 NavigationContextImpl::NavigationContextImpl(WebState* web_state, 80 NavigationContextImpl::NavigationContextImpl(WebState* web_state,
75 const GURL& url) 81 const GURL& url,
82 ui::PageTransition page_transition)
76 : web_state_(web_state), 83 : web_state_(web_state),
77 url_(url), 84 url_(url),
85 page_transition_(page_transition),
78 is_same_document_(false), 86 is_same_document_(false),
79 error_(nil), 87 error_(nil),
80 response_headers_(nullptr) {} 88 response_headers_(nullptr) {}
81 89
82 NavigationContextImpl::~NavigationContextImpl() = default; 90 NavigationContextImpl::~NavigationContextImpl() = default;
83 91
84 } // namespace web 92 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/navigation_context_impl.h ('k') | ios/web/web_state/navigation_context_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698