OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/web/navigation/navigation_item_impl.h" | 5 #include "ios/web/navigation/navigation_item_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <utility> | 10 #include <utility> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/url_formatter/url_formatter.h" | 13 #include "components/url_formatter/url_formatter.h" |
14 #include "ui/base/page_transition_types.h" | 14 #include "ui/base/page_transition_types.h" |
15 #include "ui/gfx/text_elider.h" | 15 #include "ui/gfx/text_elider.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Returns a new unique ID for use in NavigationItem during construction. The | 19 // Returns a new unique ID for use in NavigationItem during construction. The |
20 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 20 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
21 static int GetUniqueIDInConstructor() { | 21 static int GetUniqueIDInConstructor() { |
22 static int unique_id_counter = 0; | 22 static int unique_id_counter = 0; |
23 return ++unique_id_counter; | 23 return ++unique_id_counter; |
24 } | 24 } |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 namespace web { | 28 namespace web { |
29 | 29 |
30 // static | 30 // static |
31 scoped_ptr<NavigationItem> NavigationItem::Create() { | 31 std::unique_ptr<NavigationItem> NavigationItem::Create() { |
32 return scoped_ptr<NavigationItem>(new NavigationItemImpl()); | 32 return std::unique_ptr<NavigationItem>(new NavigationItemImpl()); |
33 } | 33 } |
34 | 34 |
35 NavigationItemImpl::NavigationItemImpl() | 35 NavigationItemImpl::NavigationItemImpl() |
36 : unique_id_(GetUniqueIDInConstructor()), | 36 : unique_id_(GetUniqueIDInConstructor()), |
37 transition_type_(ui::PAGE_TRANSITION_LINK), | 37 transition_type_(ui::PAGE_TRANSITION_LINK), |
38 is_overriding_user_agent_(false), | 38 is_overriding_user_agent_(false), |
39 is_created_from_push_state_(false), | 39 is_created_from_push_state_(false), |
40 should_skip_resubmit_data_confirmation_(false), | 40 should_skip_resubmit_data_confirmation_(false), |
41 is_renderer_initiated_(false), | 41 is_renderer_initiated_(false), |
42 is_unsafe_(false), | 42 is_unsafe_(false), |
(...skipping 21 matching lines...) Expand all Loading... |
64 should_skip_resubmit_data_confirmation_( | 64 should_skip_resubmit_data_confirmation_( |
65 item.should_skip_resubmit_data_confirmation_), | 65 item.should_skip_resubmit_data_confirmation_), |
66 post_data_([item.post_data_ copy]), | 66 post_data_([item.post_data_ copy]), |
67 is_renderer_initiated_(item.is_renderer_initiated_), | 67 is_renderer_initiated_(item.is_renderer_initiated_), |
68 is_unsafe_(item.is_unsafe_), | 68 is_unsafe_(item.is_unsafe_), |
69 cached_display_title_(item.cached_display_title_), | 69 cached_display_title_(item.cached_display_title_), |
70 facade_delegate_(nullptr) { | 70 facade_delegate_(nullptr) { |
71 } | 71 } |
72 | 72 |
73 void NavigationItemImpl::SetFacadeDelegate( | 73 void NavigationItemImpl::SetFacadeDelegate( |
74 scoped_ptr<NavigationItemFacadeDelegate> facade_delegate) { | 74 std::unique_ptr<NavigationItemFacadeDelegate> facade_delegate) { |
75 facade_delegate_ = std::move(facade_delegate); | 75 facade_delegate_ = std::move(facade_delegate); |
76 } | 76 } |
77 | 77 |
78 NavigationItemFacadeDelegate* NavigationItemImpl::GetFacadeDelegate() const { | 78 NavigationItemFacadeDelegate* NavigationItemImpl::GetFacadeDelegate() const { |
79 return facade_delegate_.get(); | 79 return facade_delegate_.get(); |
80 } | 80 } |
81 | 81 |
82 int NavigationItemImpl::GetUniqueID() const { | 82 int NavigationItemImpl::GetUniqueID() const { |
83 return unique_id_; | 83 return unique_id_; |
84 } | 84 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 http_request_headers_.reset(); | 270 http_request_headers_.reset(); |
271 } | 271 } |
272 | 272 |
273 void NavigationItemImpl::ResetForCommit() { | 273 void NavigationItemImpl::ResetForCommit() { |
274 // Any state that only matters when a navigation item is pending should be | 274 // Any state that only matters when a navigation item is pending should be |
275 // cleared here. | 275 // cleared here. |
276 set_is_renderer_initiated(false); | 276 set_is_renderer_initiated(false); |
277 } | 277 } |
278 | 278 |
279 } // namespace web | 279 } // namespace web |
OLD | NEW |