OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/web_state/ui/wk_back_forward_list_item_holder.h" | 5 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #import "ios/web/public/navigation_item.h" | 8 #import "ios/web/public/navigation_item.h" |
9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
10 namespace web { | 14 namespace web { |
11 | 15 |
12 namespace { | 16 namespace { |
13 // Private key used for safe conversion of base::SupportsUserData to | 17 // Private key used for safe conversion of base::SupportsUserData to |
14 // web::WKBackForwardListItemHolder in | 18 // web::WKBackForwardListItemHolder in |
15 // web::WKBackForwardListItemHolder::FromNavigationItem. | 19 // web::WKBackForwardListItemHolder::FromNavigationItem. |
16 const char kBackForwardListItemIdentifierKey[] = | 20 const char kBackForwardListItemIdentifierKey[] = |
17 "BackForwardListItemIdentifierKey"; | 21 "BackForwardListItemIdentifierKey"; |
18 } | 22 } |
19 | 23 |
(...skipping 10 matching lines...) Expand all Loading... |
30 item->GetUserData(kBackForwardListItemIdentifierKey); | 34 item->GetUserData(kBackForwardListItemIdentifierKey); |
31 if (!user_data) { | 35 if (!user_data) { |
32 user_data = new WKBackForwardListItemHolder(); | 36 user_data = new WKBackForwardListItemHolder(); |
33 item->SetUserData(kBackForwardListItemIdentifierKey, | 37 item->SetUserData(kBackForwardListItemIdentifierKey, |
34 base::WrapUnique(user_data)); | 38 base::WrapUnique(user_data)); |
35 } | 39 } |
36 return static_cast<WKBackForwardListItemHolder*>(user_data); | 40 return static_cast<WKBackForwardListItemHolder*>(user_data); |
37 } | 41 } |
38 | 42 |
39 } // namespace web | 43 } // namespace web |
OLD | NEW |