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

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

Issue 2672953005: Updated ownership of NavigationItems within CRWSessionController. (Closed)
Patch Set: fix unittests Created 3 years, 10 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 2462bfc6cc481a509c70041ab2a52f07f8df2bb2..a64d16b60f899139abfbfb27af8cd28f3035c839 100644
--- a/ios/web/navigation/crw_session_entry.mm
+++ b/ios/web/navigation/crw_session_entry.mm
@@ -21,54 +21,42 @@
#endif
@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;
}
@end
@implementation CRWSessionEntry
-- (instancetype)initWithNavigationItem:
- (std::unique_ptr<web::NavigationItem>)item {
+- (instancetype)initWithNavigationItem:(web::NavigationItem*)item {
self = [super init];
if (self) {
- _navigationItem.reset(
- static_cast<web::NavigationItemImpl*>(item.release()));
+ DCHECK(item);
+ _item = static_cast<web::NavigationItemImpl*>(item);
}
return self;
}
-// TODO(ios): Shall we overwrite EqualTo:?
-
-- (instancetype)copyWithZone:(NSZone*)zone {
- CRWSessionEntry* copy = [[[self class] alloc] init];
- copy->_navigationItem.reset(
- new web::NavigationItemImpl(*_navigationItem.get()));
- return copy;
-}
-
- (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(),
- _navigationItem->GetPageDisplayState().GetDescription(),
- _navigationItem->IsOverridingUserAgent()];
+ base::SysUTF8ToNSString(_item->GetURL().spec()),
+ base::SysUTF8ToNSString(_item->GetOriginalRequestURL().spec()),
+ base::SysUTF16ToNSString(_item->GetTitle()),
+ _item->GetTransitionType(),
+ _item->GetPageDisplayState().GetDescription(),
+ _item->IsOverridingUserAgent()];
}
- (web::NavigationItem*)navigationItem {
- return _navigationItem.get();
+ return _item;
}
- (web::NavigationItemImpl*)navigationItemImpl {
- return _navigationItem.get();
+ return _item;
}
@end
« 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