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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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
« no previous file with comments | « ios/web/ios_web.gyp ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/url_formatter/url_formatter.h"
10 #include "ui/base/page_transition_types.h" 10 #include "ui/base/page_transition_types.h"
11 #include "ui/gfx/text_elider.h" 11 #include "ui/gfx/text_elider.h"
12 12
13 namespace { 13 namespace {
14 14
15 // Returns a new unique ID for use in NavigationItem during construction. The 15 // Returns a new unique ID for use in NavigationItem during construction. The
16 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator). 16 // returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
17 static int GetUniqueIDInConstructor() { 17 static int GetUniqueIDInConstructor() {
18 static int unique_id_counter = 0; 18 static int unique_id_counter = 0;
19 return ++unique_id_counter; 19 return ++unique_id_counter;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return title_; 131 return title_;
132 132
133 // 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
134 // cache since it's more complicated to compute. 134 // cache since it's more complicated to compute.
135 if (!cached_display_title_.empty()) 135 if (!cached_display_title_.empty())
136 return cached_display_title_; 136 return cached_display_title_;
137 137
138 // Use the virtual URL first if any, and fall back on using the real URL. 138 // Use the virtual URL first if any, and fall back on using the real URL.
139 base::string16 title; 139 base::string16 title;
140 if (!virtual_url_.is_empty()) { 140 if (!virtual_url_.is_empty()) {
141 title = net::FormatUrl(virtual_url_, languages); 141 title = url_formatter::FormatUrl(virtual_url_, languages);
142 } else if (!url_.is_empty()) { 142 } else if (!url_.is_empty()) {
143 title = net::FormatUrl(url_, languages); 143 title = url_formatter::FormatUrl(url_, languages);
144 } 144 }
145 145
146 // For file:// URLs use the filename as the title, not the full path. 146 // For file:// URLs use the filename as the title, not the full path.
147 if (url_.SchemeIsFile()) { 147 if (url_.SchemeIsFile()) {
148 base::string16::size_type slashpos = title.rfind('/'); 148 base::string16::size_type slashpos = title.rfind('/');
149 if (slashpos != base::string16::npos) 149 if (slashpos != base::string16::npos)
150 title = title.substr(slashpos + 1); 150 title = title.substr(slashpos + 1);
151 } 151 }
152 152
153 const int kMaxTitleChars = 4 * 1024; 153 const int kMaxTitleChars = 4 * 1024;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 http_request_headers_.reset(); 267 http_request_headers_.reset();
268 } 268 }
269 269
270 void NavigationItemImpl::ResetForCommit() { 270 void NavigationItemImpl::ResetForCommit() {
271 // Any state that only matters when a navigation item is pending should be 271 // Any state that only matters when a navigation item is pending should be
272 // cleared here. 272 // cleared here.
273 set_is_renderer_initiated(false); 273 set_is_renderer_initiated(false);
274 } 274 }
275 275
276 } // namespace web 276 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/ios_web.gyp ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698