Chromium Code Reviews| 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 #include "ios/web/navigation/navigation_item_impl.h" | 5 #include "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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 197 |
| 198 bool NavigationItemImpl::IsOverridingUserAgent() const { | 198 bool NavigationItemImpl::IsOverridingUserAgent() const { |
| 199 return is_overriding_user_agent_; | 199 return is_overriding_user_agent_; |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool NavigationItemImpl::HasPostData() const { | 202 bool NavigationItemImpl::HasPostData() const { |
| 203 return post_data_.get() != nil; | 203 return post_data_.get() != nil; |
| 204 } | 204 } |
| 205 | 205 |
| 206 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const { | 206 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const { |
| 207 return [[http_request_headers_ copy] autorelease]; | 207 return [http_request_headers_ copy]; |
|
Eugene But (OOO till 7-30)
2016/08/01 21:13:48
This looks like a leak because compiler does not k
stkhapugin
2016/08/18 17:09:36
Autorelease will be inserted by clang with ARC.
| |
| 208 } | 208 } |
| 209 | 209 |
| 210 void NavigationItemImpl::AddHttpRequestHeaders( | 210 void NavigationItemImpl::AddHttpRequestHeaders( |
| 211 NSDictionary* additional_headers) { | 211 NSDictionary* additional_headers) { |
| 212 if (!additional_headers) | 212 if (!additional_headers) |
| 213 return; | 213 return; |
| 214 | 214 |
| 215 if (http_request_headers_) | 215 if (http_request_headers_) |
| 216 [http_request_headers_ addEntriesFromDictionary:additional_headers]; | 216 [http_request_headers_ addEntriesFromDictionary:additional_headers]; |
| 217 else | 217 else |
| 218 http_request_headers_.reset([additional_headers mutableCopy]); | 218 http_request_headers_.reset([additional_headers mutableCopy]); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void NavigationItemImpl::SetSerializedStateObject( | 221 void NavigationItemImpl::SetSerializedStateObject( |
| 222 NSString* serialized_state_object) { | 222 NSString* serialized_state_object) { |
| 223 serialized_state_object_.reset([serialized_state_object retain]); | 223 serialized_state_object_.reset(serialized_state_object); |
| 224 } | 224 } |
| 225 | 225 |
| 226 NSString* NavigationItemImpl::GetSerializedStateObject() const { | 226 NSString* NavigationItemImpl::GetSerializedStateObject() const { |
| 227 return serialized_state_object_.get(); | 227 return serialized_state_object_.get(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void NavigationItemImpl::SetIsCreatedFromPushState(bool push_state) { | 230 void NavigationItemImpl::SetIsCreatedFromPushState(bool push_state) { |
| 231 is_created_from_push_state_ = push_state; | 231 is_created_from_push_state_ = push_state; |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool NavigationItemImpl::IsCreatedFromPushState() const { | 234 bool NavigationItemImpl::IsCreatedFromPushState() const { |
| 235 return is_created_from_push_state_; | 235 return is_created_from_push_state_; |
| 236 } | 236 } |
| 237 | 237 |
| 238 void NavigationItemImpl::SetShouldSkipResubmitDataConfirmation(bool skip) { | 238 void NavigationItemImpl::SetShouldSkipResubmitDataConfirmation(bool skip) { |
| 239 should_skip_resubmit_data_confirmation_ = skip; | 239 should_skip_resubmit_data_confirmation_ = skip; |
| 240 } | 240 } |
| 241 | 241 |
| 242 bool NavigationItemImpl::ShouldSkipResubmitDataConfirmation() const { | 242 bool NavigationItemImpl::ShouldSkipResubmitDataConfirmation() const { |
| 243 return should_skip_resubmit_data_confirmation_; | 243 return should_skip_resubmit_data_confirmation_; |
| 244 } | 244 } |
| 245 | 245 |
| 246 void NavigationItemImpl::SetPostData(NSData* post_data) { | 246 void NavigationItemImpl::SetPostData(NSData* post_data) { |
| 247 post_data_.reset([post_data retain]); | 247 post_data_.reset(post_data); |
| 248 } | 248 } |
| 249 | 249 |
| 250 NSData* NavigationItemImpl::GetPostData() const { | 250 NSData* NavigationItemImpl::GetPostData() const { |
| 251 return post_data_.get(); | 251 return post_data_.get(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void NavigationItemImpl::RemoveHttpRequestHeaderForKey(NSString* key) { | 254 void NavigationItemImpl::RemoveHttpRequestHeaderForKey(NSString* key) { |
| 255 DCHECK(key); | 255 DCHECK(key); |
| 256 [http_request_headers_ removeObjectForKey:key]; | 256 [http_request_headers_ removeObjectForKey:key]; |
| 257 if (![http_request_headers_ count]) | 257 if (![http_request_headers_ count]) |
| 258 http_request_headers_.reset(); | 258 http_request_headers_.reset(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 void NavigationItemImpl::ResetHttpRequestHeaders() { | 261 void NavigationItemImpl::ResetHttpRequestHeaders() { |
| 262 http_request_headers_.reset(); | 262 http_request_headers_.reset(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void NavigationItemImpl::ResetForCommit() { | 265 void NavigationItemImpl::ResetForCommit() { |
| 266 // Any state that only matters when a navigation item is pending should be | 266 // Any state that only matters when a navigation item is pending should be |
| 267 // cleared here. | 267 // cleared here. |
| 268 set_is_renderer_initiated(false); | 268 set_is_renderer_initiated(false); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace web | 271 } // namespace web |
| OLD | NEW |