| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/navigation/navigation_item_impl.h" | 5 #import "ios/web/navigation/navigation_item_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 namespace web { | 33 namespace web { |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 std::unique_ptr<NavigationItem> NavigationItem::Create() { | 36 std::unique_ptr<NavigationItem> NavigationItem::Create() { |
| 37 return std::unique_ptr<NavigationItem>(new NavigationItemImpl()); | 37 return std::unique_ptr<NavigationItem>(new NavigationItemImpl()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 NavigationItemImpl::NavigationItemImpl() | 40 NavigationItemImpl::NavigationItemImpl() |
| 41 : unique_id_(GetUniqueIDInConstructor()), | 41 : unique_id_(GetUniqueIDInConstructor()), |
| 42 transition_type_(ui::PAGE_TRANSITION_LINK), | 42 transition_type_(ui::PAGE_TRANSITION_LINK), |
| 43 is_overriding_user_agent_(false), | 43 user_agent_type_(UserAgentType::MOBILE), |
| 44 is_created_from_push_state_(false), | 44 is_created_from_push_state_(false), |
| 45 has_state_been_replaced_(false), | 45 has_state_been_replaced_(false), |
| 46 is_created_from_hash_change_(false), | 46 is_created_from_hash_change_(false), |
| 47 should_skip_repost_form_confirmation_(false), | 47 should_skip_repost_form_confirmation_(false), |
| 48 navigation_initiation_type_(web::NavigationInitiationType::NONE), | 48 navigation_initiation_type_(web::NavigationInitiationType::NONE), |
| 49 is_unsafe_(false), | 49 is_unsafe_(false), |
| 50 facade_delegate_(nullptr) {} | 50 facade_delegate_(nullptr) {} |
| 51 | 51 |
| 52 NavigationItemImpl::~NavigationItemImpl() { | 52 NavigationItemImpl::~NavigationItemImpl() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 NavigationItemImpl::NavigationItemImpl(const NavigationItemImpl& item) | 55 NavigationItemImpl::NavigationItemImpl(const NavigationItemImpl& item) |
| 56 : unique_id_(item.unique_id_), | 56 : unique_id_(item.unique_id_), |
| 57 original_request_url_(item.original_request_url_), | 57 original_request_url_(item.original_request_url_), |
| 58 url_(item.url_), | 58 url_(item.url_), |
| 59 referrer_(item.referrer_), | 59 referrer_(item.referrer_), |
| 60 virtual_url_(item.virtual_url_), | 60 virtual_url_(item.virtual_url_), |
| 61 title_(item.title_), | 61 title_(item.title_), |
| 62 page_display_state_(item.page_display_state_), | 62 page_display_state_(item.page_display_state_), |
| 63 transition_type_(item.transition_type_), | 63 transition_type_(item.transition_type_), |
| 64 favicon_(item.favicon_), | 64 favicon_(item.favicon_), |
| 65 ssl_(item.ssl_), | 65 ssl_(item.ssl_), |
| 66 timestamp_(item.timestamp_), | 66 timestamp_(item.timestamp_), |
| 67 is_overriding_user_agent_(item.is_overriding_user_agent_), | 67 user_agent_type_(item.user_agent_type_), |
| 68 http_request_headers_([item.http_request_headers_ copy]), | 68 http_request_headers_([item.http_request_headers_ copy]), |
| 69 serialized_state_object_([item.serialized_state_object_ copy]), | 69 serialized_state_object_([item.serialized_state_object_ copy]), |
| 70 is_created_from_push_state_(item.is_created_from_push_state_), | 70 is_created_from_push_state_(item.is_created_from_push_state_), |
| 71 has_state_been_replaced_(item.has_state_been_replaced_), | 71 has_state_been_replaced_(item.has_state_been_replaced_), |
| 72 is_created_from_hash_change_(item.is_created_from_hash_change_), | 72 is_created_from_hash_change_(item.is_created_from_hash_change_), |
| 73 should_skip_repost_form_confirmation_( | 73 should_skip_repost_form_confirmation_( |
| 74 item.should_skip_repost_form_confirmation_), | 74 item.should_skip_repost_form_confirmation_), |
| 75 post_data_([item.post_data_ copy]), | 75 post_data_([item.post_data_ copy]), |
| 76 navigation_initiation_type_(item.navigation_initiation_type_), | 76 navigation_initiation_type_(item.navigation_initiation_type_), |
| 77 is_unsafe_(item.is_unsafe_), | 77 is_unsafe_(item.is_unsafe_), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 void NavigationItemImpl::SetTimestamp(base::Time timestamp) { | 201 void NavigationItemImpl::SetTimestamp(base::Time timestamp) { |
| 202 timestamp_ = timestamp; | 202 timestamp_ = timestamp; |
| 203 } | 203 } |
| 204 | 204 |
| 205 base::Time NavigationItemImpl::GetTimestamp() const { | 205 base::Time NavigationItemImpl::GetTimestamp() const { |
| 206 return timestamp_; | 206 return timestamp_; |
| 207 } | 207 } |
| 208 | 208 |
| 209 void NavigationItemImpl::SetIsOverridingUserAgent( | 209 void NavigationItemImpl::SetUserAgentType(UserAgentType type) { |
| 210 bool is_overriding_user_agent) { | 210 user_agent_type_ = type; |
| 211 is_overriding_user_agent_ = is_overriding_user_agent; | |
| 212 } | 211 } |
| 213 | 212 |
| 214 bool NavigationItemImpl::IsOverridingUserAgent() const { | 213 UserAgentType NavigationItemImpl::GetUserAgentType() const { |
| 215 return is_overriding_user_agent_; | 214 return user_agent_type_; |
| 216 } | 215 } |
| 217 | 216 |
| 218 bool NavigationItemImpl::HasPostData() const { | 217 bool NavigationItemImpl::HasPostData() const { |
| 219 return post_data_.get() != nil; | 218 return post_data_.get() != nil; |
| 220 } | 219 } |
| 221 | 220 |
| 222 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const { | 221 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const { |
| 223 return [http_request_headers_ copy]; | 222 return [http_request_headers_ copy]; |
| 224 } | 223 } |
| 225 | 224 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 http_request_headers_.reset(); | 303 http_request_headers_.reset(); |
| 305 } | 304 } |
| 306 | 305 |
| 307 void NavigationItemImpl::ResetForCommit() { | 306 void NavigationItemImpl::ResetForCommit() { |
| 308 // Navigation initiation type is only valid for pending navigations, thus | 307 // Navigation initiation type is only valid for pending navigations, thus |
| 309 // always reset to NONE after the item is committed. | 308 // always reset to NONE after the item is committed. |
| 310 SetNavigationInitiationType(web::NavigationInitiationType::NONE); | 309 SetNavigationInitiationType(web::NavigationInitiationType::NONE); |
| 311 } | 310 } |
| 312 | 311 |
| 313 } // namespace web | 312 } // namespace web |
| OLD | NEW |