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

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

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/crw_session_entry.h" 5 #import "ios/web/navigation/crw_session_entry.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
10
9 #include "base/mac/objc_property_releaser.h" 11 #include "base/mac/objc_property_releaser.h"
10 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
13 #include "ios/web/navigation/navigation_item_impl.h" 14 #include "ios/web/navigation/navigation_item_impl.h"
14 #include "ios/web/navigation/nscoder_util.h" 15 #include "ios/web/navigation/nscoder_util.h"
15 #include "ios/web/public/navigation_item.h" 16 #include "ios/web/public/navigation_item.h"
16 #include "ios/web/public/web_state/page_display_state.h" 17 #include "ios/web/public/web_state/page_display_state.h"
17 #import "net/base/mac/url_conversions.h" 18 #import "net/base/mac/url_conversions.h"
18 19
19 namespace web { 20 namespace web {
20 // Keys used to serialize web::PageScrollState properties. 21 // Keys used to serialize web::PageScrollState properties.
21 NSString* const kSessionEntryPageScrollStateKey = @"state"; 22 NSString* const kSessionEntryPageScrollStateKey = @"state";
(...skipping 19 matching lines...) Expand all
41 } 42 }
42 43
43 @interface CRWSessionEntry () { 44 @interface CRWSessionEntry () {
44 // The original URL of the page. In cases where a redirect occurred, |url_| 45 // The original URL of the page. In cases where a redirect occurred, |url_|
45 // will contain the final post-redirect URL, and |originalUrl_| will contain 46 // will contain the final post-redirect URL, and |originalUrl_| will contain
46 // the pre-redirect URL. This field is not persisted to disk. 47 // the pre-redirect URL. This field is not persisted to disk.
47 GURL _originalUrl; 48 GURL _originalUrl;
48 49
49 // The NavigationItemImpl corresponding to this CRWSessionEntry. 50 // The NavigationItemImpl corresponding to this CRWSessionEntry.
50 // TODO(stuartmorgan): Move ownership to NavigationManagerImpl. 51 // TODO(stuartmorgan): Move ownership to NavigationManagerImpl.
51 scoped_ptr<web::NavigationItemImpl> _navigationItem; 52 std::unique_ptr<web::NavigationItemImpl> _navigationItem;
52 53
53 base::mac::ObjCPropertyReleaser _propertyReleaser_CRWSessionEntry; 54 base::mac::ObjCPropertyReleaser _propertyReleaser_CRWSessionEntry;
54 } 55 }
55 // Redefine originalUrl to be read-write. 56 // Redefine originalUrl to be read-write.
56 @property(nonatomic, readwrite) const GURL& originalUrl; 57 @property(nonatomic, readwrite) const GURL& originalUrl;
57 58
58 // Converts a serialized NSDictionary to a web::PageDisplayState. 59 // Converts a serialized NSDictionary to a web::PageDisplayState.
59 + (web::PageDisplayState)pageDisplayStateFromDictionary: 60 + (web::PageDisplayState)pageDisplayStateFromDictionary:
60 (NSDictionary*)dictionary; 61 (NSDictionary*)dictionary;
61 // Serializes a web::PageDisplayState to an NSDictionary. 62 // Serializes a web::PageDisplayState to an NSDictionary.
62 + (NSDictionary*)dictionaryFromPageDisplayState: 63 + (NSDictionary*)dictionaryFromPageDisplayState:
63 (const web::PageDisplayState&)displayState; 64 (const web::PageDisplayState&)displayState;
64 // Returns a readable description of |displayState|. 65 // Returns a readable description of |displayState|.
65 + (NSString*)descriptionForPageDisplayState: 66 + (NSString*)descriptionForPageDisplayState:
66 (const web::PageDisplayState&)displayState; 67 (const web::PageDisplayState&)displayState;
67 @end 68 @end
68 69
69 @implementation CRWSessionEntry 70 @implementation CRWSessionEntry
70 71
71 @synthesize originalUrl = _originalUrl; 72 @synthesize originalUrl = _originalUrl;
72 73
73 - (instancetype)initWithNavigationItem:(scoped_ptr<web::NavigationItem>)item { 74 - (instancetype)initWithNavigationItem:
75 (std::unique_ptr<web::NavigationItem>)item {
74 self = [super init]; 76 self = [super init];
75 if (self) { 77 if (self) {
76 _propertyReleaser_CRWSessionEntry.Init(self, [CRWSessionEntry class]); 78 _propertyReleaser_CRWSessionEntry.Init(self, [CRWSessionEntry class]);
77 _navigationItem.reset( 79 _navigationItem.reset(
78 static_cast<web::NavigationItemImpl*>(item.release())); 80 static_cast<web::NavigationItemImpl*>(item.release()));
79 self.originalUrl = _navigationItem->GetURL(); 81 self.originalUrl = _navigationItem->GetURL();
80 } 82 }
81 return self; 83 return self;
82 } 84 }
83 85
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return 248 return
247 [NSString stringWithFormat:kPageScrollStateDescriptionFormat, 249 [NSString stringWithFormat:kPageScrollStateDescriptionFormat,
248 displayState.scroll_state().offset_x(), 250 displayState.scroll_state().offset_x(),
249 displayState.scroll_state().offset_y(), 251 displayState.scroll_state().offset_y(),
250 displayState.zoom_state().minimum_zoom_scale(), 252 displayState.zoom_state().minimum_zoom_scale(),
251 displayState.zoom_state().maximum_zoom_scale(), 253 displayState.zoom_state().maximum_zoom_scale(),
252 displayState.zoom_state().zoom_scale()]; 254 displayState.zoom_state().zoom_scale()];
253 } 255 }
254 256
255 @end 257 @end
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_entry.h ('k') | ios/web/navigation/crw_session_entry_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698