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

Side by Side Diff: ios/web/navigation/navigation_item_impl.mm

Issue 1028603004: Upstream ios/web/navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ios-testing
Patch Set: Rebase and resync Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "ui/base/page_transition_types.h" 10 #include "ui/base/page_transition_types.h"
(...skipping 13 matching lines...) Expand all
24 namespace web { 24 namespace web {
25 25
26 // static 26 // static
27 scoped_ptr<NavigationItem> NavigationItem::Create() { 27 scoped_ptr<NavigationItem> NavigationItem::Create() {
28 return scoped_ptr<NavigationItem>(new NavigationItemImpl()); 28 return scoped_ptr<NavigationItem>(new NavigationItemImpl());
29 } 29 }
30 30
31 NavigationItemImpl::NavigationItemImpl() 31 NavigationItemImpl::NavigationItemImpl()
32 : unique_id_(GetUniqueIDInConstructor()), 32 : unique_id_(GetUniqueIDInConstructor()),
33 page_id_(-1), 33 page_id_(-1),
34 transition_type_(ui::PAGE_TRANSITION_LINK) { 34 transition_type_(ui::PAGE_TRANSITION_LINK),
35 is_renderer_initiated_(false),
36 is_unsafe_(false),
37 facade_delegate_(nullptr) {
35 } 38 }
36 39
37 NavigationItemImpl::~NavigationItemImpl() { 40 NavigationItemImpl::~NavigationItemImpl() {
38 } 41 }
39 42
43 NavigationItemImpl::NavigationItemImpl(const NavigationItemImpl& item)
44 : unique_id_(item.unique_id_),
45 url_(item.url_),
46 referrer_(item.referrer_),
47 virtual_url_(item.virtual_url_),
48 title_(item.title_),
49 page_id_(item.page_id_),
50 page_scroll_state_(item.page_scroll_state_),
51 transition_type_(item.transition_type_),
52 favicon_(item.favicon_),
53 ssl_(item.ssl_),
54 timestamp_(item.timestamp_),
55 is_renderer_initiated_(item.is_renderer_initiated_),
56 is_unsafe_(item.is_unsafe_),
57 cached_display_title_(item.cached_display_title_),
58 facade_delegate_(nullptr) {
59 }
60
61 void NavigationItemImpl::SetFacadeDelegate(
62 scoped_ptr<NavigationItemFacadeDelegate> facade_delegate) {
63 facade_delegate_ = facade_delegate.Pass();
64 }
65
66 NavigationItemFacadeDelegate* NavigationItemImpl::GetFacadeDelegate() const {
67 return facade_delegate_.get();
68 }
69
40 int NavigationItemImpl::GetUniqueID() const { 70 int NavigationItemImpl::GetUniqueID() const {
41 return unique_id_; 71 return unique_id_;
42 } 72 }
43 73
44 void NavigationItemImpl::SetURL(const GURL& url) { 74 void NavigationItemImpl::SetURL(const GURL& url) {
45 url_ = url; 75 url_ = url;
46 cached_display_title_.clear(); 76 cached_display_title_.clear();
47 } 77 }
48 78
49 const GURL& NavigationItemImpl::GetURL() const { 79 const GURL& NavigationItemImpl::GetURL() const {
(...skipping 27 matching lines...) Expand all
77 } 107 }
78 108
79 void NavigationItemImpl::SetPageID(int page_id) { 109 void NavigationItemImpl::SetPageID(int page_id) {
80 page_id_ = page_id; 110 page_id_ = page_id;
81 } 111 }
82 112
83 int32 NavigationItemImpl::GetPageID() const { 113 int32 NavigationItemImpl::GetPageID() const {
84 return page_id_; 114 return page_id_;
85 } 115 }
86 116
117 void NavigationItemImpl::SetPageScrollState(
118 const web::PageScrollState& scroll_state) {
119 page_scroll_state_ = scroll_state;
120 }
121
122 const PageScrollState& NavigationItemImpl::GetPageScrollState() const {
123 return page_scroll_state_;
124 }
125
87 const base::string16& NavigationItemImpl::GetTitleForDisplay( 126 const base::string16& NavigationItemImpl::GetTitleForDisplay(
88 const std::string& languages) const { 127 const std::string& languages) const {
89 // Most pages have real titles. Don't even bother caching anything if this is 128 // Most pages have real titles. Don't even bother caching anything if this is
90 // the case. 129 // the case.
91 if (!title_.empty()) 130 if (!title_.empty())
92 return title_; 131 return title_;
93 132
94 // More complicated cases will use the URLs as the title. This result we will 133 // More complicated cases will use the URLs as the title. This result we will
95 // cache since it's more complicated to compute. 134 // cache since it's more complicated to compute.
96 if (!cached_display_title_.empty()) 135 if (!cached_display_title_.empty())
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 180 }
142 181
143 void NavigationItemImpl::SetTimestamp(base::Time timestamp) { 182 void NavigationItemImpl::SetTimestamp(base::Time timestamp) {
144 timestamp_ = timestamp; 183 timestamp_ = timestamp;
145 } 184 }
146 185
147 base::Time NavigationItemImpl::GetTimestamp() const { 186 base::Time NavigationItemImpl::GetTimestamp() const {
148 return timestamp_; 187 return timestamp_;
149 } 188 }
150 189
190 void NavigationItemImpl::ResetForCommit() {
191 // Any state that only matters when a navigation item is pending should be
192 // cleared here.
193 set_is_renderer_initiated(false);
194 }
195
196 void NavigationItemImpl::SetUnsafe(bool is_unsafe) {
197 is_unsafe_ = is_unsafe;
198 }
199
200 bool NavigationItemImpl::IsUnsafe() const {
201 return is_unsafe_;
202 }
203
151 } // namespace web 204 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/navigation_item_impl.h ('k') | ios/web/navigation/navigation_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698