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

Unified Diff: ios/web/navigation/crw_session_entry.mm

Issue 2672723003: Converted CRWSessionController to use NavigationItems. (Closed)
Patch Set: test fixes, self review Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/crw_session_entry.mm
diff --git a/ios/web/navigation/crw_session_entry.mm b/ios/web/navigation/crw_session_entry.mm
index 816fef83915216132a04e8bff96bd1a2450b762d..0ade76331f853a83bdb9240565afe23d0bad5761 100644
--- a/ios/web/navigation/crw_session_entry.mm
+++ b/ios/web/navigation/crw_session_entry.mm
@@ -45,9 +45,8 @@
}
@interface CRWSessionEntry () {
- // The NavigationItemImpl corresponding to this CRWSessionEntry.
- // TODO(stuartmorgan): Move ownership to NavigationManagerImpl.
- std::unique_ptr<web::NavigationItemImpl> _navigationItem;
+ // The NavigationItem passed on initialization.
+ web::NavigationItemImpl* _item;
}
// Returns a readable description of |displayState|.
@@ -57,47 +56,38 @@ + (NSString*)descriptionForPageDisplayState:
@implementation CRWSessionEntry
-- (instancetype)initWithNavigationItem:
- (std::unique_ptr<web::NavigationItem>)item {
- self = [super init];
- if (self) {
- _navigationItem.reset(
- static_cast<web::NavigationItemImpl*>(item.release()));
+- (instancetype)initWithNavigationItem:(web::NavigationItemImpl*)item {
+ if ((self = [super init])) {
+ DCHECK(item);
+ _item = item;
}
return self;
}
-// TODO(ios): Shall we overwrite EqualTo:?
+#pragma mark - Accessors
-- (instancetype)copyWithZone:(NSZone*)zone {
- CRWSessionEntry* copy = [[[self class] alloc] init];
- copy->_navigationItem.reset(
- new web::NavigationItemImpl(*_navigationItem.get()));
- return copy;
+- (web::NavigationItem*)navigationItem {
+ return _item;
+}
+
+- (web::NavigationItemImpl*)navigationItemImpl {
+ return _item;
}
+#pragma mark - NSObject
+
- (NSString*)description {
return [NSString
stringWithFormat:
@"url:%@ originalurl:%@ title:%@ transition:%d displayState:%@ "
@"desktopUA:%d",
- base::SysUTF8ToNSString(_navigationItem->GetURL().spec()),
- base::SysUTF8ToNSString(
- _navigationItem->GetOriginalRequestURL().spec()),
- base::SysUTF16ToNSString(_navigationItem->GetTitle()),
- _navigationItem->GetTransitionType(),
+ base::SysUTF8ToNSString(_item->GetURL().spec()),
+ base::SysUTF8ToNSString(_item->GetOriginalRequestURL().spec()),
+ base::SysUTF16ToNSString(_item->GetTitle()),
+ _item->GetTransitionType(),
[[self class]
- descriptionForPageDisplayState:_navigationItem
- ->GetPageDisplayState()],
- _navigationItem->IsOverridingUserAgent()];
-}
-
-- (web::NavigationItem*)navigationItem {
- return _navigationItem.get();
-}
-
-- (web::NavigationItemImpl*)navigationItemImpl {
- return _navigationItem.get();
+ descriptionForPageDisplayState:_item->GetPageDisplayState()],
+ _item->IsOverridingUserAgent()];
}
#pragma mark -
« 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