OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import "ios/web/navigation/crw_session_entry.h" | |
6 | |
7 #include <stdint.h> | |
8 | |
9 #include <memory> | |
10 | |
11 #import "base/mac/scoped_nsobject.h" | |
12 #include "base/strings/sys_string_conversions.h" | |
13 #import "ios/web/navigation/navigation_item_impl.h" | |
14 #import "ios/web/navigation/nscoder_util.h" | |
15 #import "ios/web/public/navigation_item.h" | |
16 #import "ios/web/public/web_state/page_display_state.h" | |
17 #import "net/base/mac/url_conversions.h" | |
18 | |
19 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
20 #error "This file requires ARC support." | |
21 #endif | |
22 | |
23 @interface CRWSessionEntry () { | |
24 // The NavigationItemImpl corresponding to this CRWSessionEntry. | |
25 // TODO(stuartmorgan): Move ownership to NavigationManagerImpl. | |
26 std::unique_ptr<web::NavigationItemImpl> _navigationItem; | |
27 } | |
28 | |
29 @end | |
30 | |
31 @implementation CRWSessionEntry | |
32 | |
33 - (instancetype)initWithNavigationItem: | |
34 (std::unique_ptr<web::NavigationItem>)item { | |
35 self = [super init]; | |
36 if (self) { | |
37 _navigationItem.reset( | |
38 static_cast<web::NavigationItemImpl*>(item.release())); | |
39 } | |
40 return self; | |
41 } | |
42 | |
43 // TODO(ios): Shall we overwrite EqualTo:? | |
44 | |
45 - (instancetype)copyWithZone:(NSZone*)zone { | |
46 CRWSessionEntry* copy = [[[self class] alloc] init]; | |
47 copy->_navigationItem.reset( | |
48 new web::NavigationItemImpl(*_navigationItem.get())); | |
49 return copy; | |
50 } | |
51 | |
52 - (NSString*)description { | |
53 #ifndef NDEBUG | |
54 return _navigationItem->GetDescription(); | |
55 #else | |
56 return [super description]; | |
57 #endif | |
58 } | |
59 | |
60 - (web::NavigationItem*)navigationItem { | |
61 return _navigationItem.get(); | |
62 } | |
63 | |
64 - (web::NavigationItemImpl*)navigationItemImpl { | |
65 return _navigationItem.get(); | |
66 } | |
67 | |
68 @end | |
OLD | NEW |