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

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

Issue 2690913003: Revert "Updated ownership of NavigationItems within CRWSessionController." (Closed)
Patch Set: Revert olivier's CLs 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 dc381c410838a2b878467a32d1d5e5c76f00b3d8..2462bfc6cc481a509c70041ab2a52f07f8df2bb2 100644
--- a/ios/web/navigation/crw_session_entry.mm
+++ b/ios/web/navigation/crw_session_entry.mm
@@ -21,46 +21,54 @@
#endif
@interface CRWSessionEntry () {
- // The NavigationItem passed on initialization.
- web::NavigationItemImpl* _item;
+ // The NavigationItemImpl corresponding to this CRWSessionEntry.
+ // TODO(stuartmorgan): Move ownership to NavigationManagerImpl.
+ std::unique_ptr<web::NavigationItemImpl> _navigationItem;
}
@end
@implementation CRWSessionEntry
-- (instancetype)initWithNavigationItem:(web::NavigationItem*)item {
+- (instancetype)initWithNavigationItem:
+ (std::unique_ptr<web::NavigationItem>)item {
self = [super init];
if (self) {
- DCHECK(item);
- _item = static_cast<web::NavigationItemImpl*>(item);
+ _navigationItem.reset(
+ static_cast<web::NavigationItemImpl*>(item.release()));
}
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(_item->GetURL().spec()),
- base::SysUTF8ToNSString(_item->GetOriginalRequestURL().spec()),
- base::SysUTF16ToNSString(_item->GetTitle()),
- _item->GetTransitionType(),
- _item->GetPageDisplayState().GetDescription(),
- _item->IsOverridingUserAgent()];
+ base::SysUTF8ToNSString(_navigationItem->GetURL().spec()),
+ base::SysUTF8ToNSString(
+ _navigationItem->GetOriginalRequestURL().spec()),
+ base::SysUTF16ToNSString(_navigationItem->GetTitle()),
+ _navigationItem->GetTransitionType(),
+ _navigationItem->GetPageDisplayState().GetDescription(),
+ _navigationItem->IsOverridingUserAgent()];
}
- (web::NavigationItem*)navigationItem {
- return _item;
+ return _navigationItem.get();
}
- (web::NavigationItemImpl*)navigationItemImpl {
- return _item;
-}
-
-- (BOOL)isEqual:(CRWSessionEntry*)object {
- return _item == [object navigationItem];
+ return _navigationItem.get();
}
@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