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

Side by Side Diff: ios/web/navigation/navigation_item_impl.mm

Issue 2202623002: Converts parts of ios/web to ARC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra release Created 4 years, 4 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 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>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "components/url_formatter/url_formatter.h" 13 #include "components/url_formatter/url_formatter.h"
14 #include "ui/base/page_transition_types.h" 14 #include "ui/base/page_transition_types.h"
15 #include "ui/gfx/text_elider.h" 15 #include "ui/gfx/text_elider.h"
16 16
17 #if !defined(__has_feature) || !__has_feature(objc_arc)
18 #error "This file requires ARC support."
19 #endif
20
17 namespace { 21 namespace {
18 22
19 // Returns a new unique ID for use in NavigationItem during construction. The 23 // Returns a new unique ID for use in NavigationItem during construction. The
20 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator). 24 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
21 static int GetUniqueIDInConstructor() { 25 static int GetUniqueIDInConstructor() {
22 static int unique_id_counter = 0; 26 static int unique_id_counter = 0;
23 return ++unique_id_counter; 27 return ++unique_id_counter;
24 } 28 }
25 29
26 } // namespace 30 } // namespace
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 201
198 bool NavigationItemImpl::IsOverridingUserAgent() const { 202 bool NavigationItemImpl::IsOverridingUserAgent() const {
199 return is_overriding_user_agent_; 203 return is_overriding_user_agent_;
200 } 204 }
201 205
202 bool NavigationItemImpl::HasPostData() const { 206 bool NavigationItemImpl::HasPostData() const {
203 return post_data_.get() != nil; 207 return post_data_.get() != nil;
204 } 208 }
205 209
206 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const { 210 NSDictionary* NavigationItemImpl::GetHttpRequestHeaders() const {
207 return [[http_request_headers_ copy] autorelease]; 211 return [http_request_headers_ copy];
208 } 212 }
209 213
210 void NavigationItemImpl::AddHttpRequestHeaders( 214 void NavigationItemImpl::AddHttpRequestHeaders(
211 NSDictionary* additional_headers) { 215 NSDictionary* additional_headers) {
212 if (!additional_headers) 216 if (!additional_headers)
213 return; 217 return;
214 218
215 if (http_request_headers_) 219 if (http_request_headers_)
216 [http_request_headers_ addEntriesFromDictionary:additional_headers]; 220 [http_request_headers_ addEntriesFromDictionary:additional_headers];
217 else 221 else
218 http_request_headers_.reset([additional_headers mutableCopy]); 222 http_request_headers_.reset([additional_headers mutableCopy]);
219 } 223 }
220 224
221 void NavigationItemImpl::SetSerializedStateObject( 225 void NavigationItemImpl::SetSerializedStateObject(
222 NSString* serialized_state_object) { 226 NSString* serialized_state_object) {
223 serialized_state_object_.reset([serialized_state_object retain]); 227 serialized_state_object_.reset(serialized_state_object);
kkhorimoto 2016/08/19 23:15:43 How does ARC function for C++ classes that have NS
stkhapugin 2016/08/22 11:37:00 ARC treats all Cocoa object type variables in Obje
224 } 228 }
225 229
226 NSString* NavigationItemImpl::GetSerializedStateObject() const { 230 NSString* NavigationItemImpl::GetSerializedStateObject() const {
227 return serialized_state_object_.get(); 231 return serialized_state_object_.get();
228 } 232 }
229 233
230 void NavigationItemImpl::SetIsCreatedFromPushState(bool push_state) { 234 void NavigationItemImpl::SetIsCreatedFromPushState(bool push_state) {
231 is_created_from_push_state_ = push_state; 235 is_created_from_push_state_ = push_state;
232 } 236 }
233 237
234 bool NavigationItemImpl::IsCreatedFromPushState() const { 238 bool NavigationItemImpl::IsCreatedFromPushState() const {
235 return is_created_from_push_state_; 239 return is_created_from_push_state_;
236 } 240 }
237 241
238 void NavigationItemImpl::SetShouldSkipResubmitDataConfirmation(bool skip) { 242 void NavigationItemImpl::SetShouldSkipResubmitDataConfirmation(bool skip) {
239 should_skip_resubmit_data_confirmation_ = skip; 243 should_skip_resubmit_data_confirmation_ = skip;
240 } 244 }
241 245
242 bool NavigationItemImpl::ShouldSkipResubmitDataConfirmation() const { 246 bool NavigationItemImpl::ShouldSkipResubmitDataConfirmation() const {
243 return should_skip_resubmit_data_confirmation_; 247 return should_skip_resubmit_data_confirmation_;
244 } 248 }
245 249
246 void NavigationItemImpl::SetPostData(NSData* post_data) { 250 void NavigationItemImpl::SetPostData(NSData* post_data) {
247 post_data_.reset([post_data retain]); 251 post_data_.reset(post_data);
248 } 252 }
249 253
250 NSData* NavigationItemImpl::GetPostData() const { 254 NSData* NavigationItemImpl::GetPostData() const {
251 return post_data_.get(); 255 return post_data_.get();
252 } 256 }
253 257
254 void NavigationItemImpl::RemoveHttpRequestHeaderForKey(NSString* key) { 258 void NavigationItemImpl::RemoveHttpRequestHeaderForKey(NSString* key) {
255 DCHECK(key); 259 DCHECK(key);
256 [http_request_headers_ removeObjectForKey:key]; 260 [http_request_headers_ removeObjectForKey:key];
257 if (![http_request_headers_ count]) 261 if (![http_request_headers_ count])
258 http_request_headers_.reset(); 262 http_request_headers_.reset();
259 } 263 }
260 264
261 void NavigationItemImpl::ResetHttpRequestHeaders() { 265 void NavigationItemImpl::ResetHttpRequestHeaders() {
262 http_request_headers_.reset(); 266 http_request_headers_.reset();
263 } 267 }
264 268
265 void NavigationItemImpl::ResetForCommit() { 269 void NavigationItemImpl::ResetForCommit() {
266 // Any state that only matters when a navigation item is pending should be 270 // Any state that only matters when a navigation item is pending should be
267 // cleared here. 271 // cleared here.
268 set_is_renderer_initiated(false); 272 set_is_renderer_initiated(false);
269 } 273 }
270 274
271 } // namespace web 275 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698