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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/navigation_entry_impl.h" 5 #include "content/browser/frame_host/navigation_entry_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 source_site_instance_ = source_site_instance; 336 source_site_instance_ = source_site_instance;
337 } 337 }
338 338
339 void NavigationEntryImpl::SetBindings(int bindings) { 339 void NavigationEntryImpl::SetBindings(int bindings) {
340 // Ensure this is set to a valid value, and that it stays the same once set. 340 // Ensure this is set to a valid value, and that it stays the same once set.
341 CHECK_NE(bindings, kInvalidBindings); 341 CHECK_NE(bindings, kInvalidBindings);
342 CHECK(bindings_ == kInvalidBindings || bindings_ == bindings); 342 CHECK(bindings_ == kInvalidBindings || bindings_ == bindings);
343 bindings_ = bindings; 343 bindings_ = bindings;
344 } 344 }
345 345
346 const base::string16& NavigationEntryImpl::GetTitleForDisplay( 346 const base::string16& NavigationEntryImpl::GetTitleForDisplay() const {
347 const std::string& languages) const {
348 // Most pages have real titles. Don't even bother caching anything if this is 347 // Most pages have real titles. Don't even bother caching anything if this is
349 // the case. 348 // the case.
350 if (!title_.empty()) 349 if (!title_.empty())
351 return title_; 350 return title_;
352 351
353 // More complicated cases will use the URLs as the title. This result we will 352 // More complicated cases will use the URLs as the title. This result we will
354 // cache since it's more complicated to compute. 353 // cache since it's more complicated to compute.
355 if (!cached_display_title_.empty()) 354 if (!cached_display_title_.empty())
356 return cached_display_title_; 355 return cached_display_title_;
357 356
358 // Use the virtual URL first if any, and fall back on using the real URL. 357 // Use the virtual URL first if any, and fall back on using the real URL.
359 base::string16 title; 358 base::string16 title;
360 if (!virtual_url_.is_empty()) { 359 if (!virtual_url_.is_empty()) {
361 title = url_formatter::FormatUrl(virtual_url_, languages); 360 title = url_formatter::FormatUrl(virtual_url_);
362 } else if (!GetURL().is_empty()) { 361 } else if (!GetURL().is_empty()) {
363 title = url_formatter::FormatUrl(GetURL(), languages); 362 title = url_formatter::FormatUrl(GetURL());
364 } 363 }
365 364
366 // For file:// URLs use the filename as the title, not the full path. 365 // For file:// URLs use the filename as the title, not the full path.
367 if (GetURL().SchemeIsFile()) { 366 if (GetURL().SchemeIsFile()) {
368 // It is necessary to ignore the reference and query parameters or else 367 // It is necessary to ignore the reference and query parameters or else
369 // looking for slashes might accidentally return one of those values. See 368 // looking for slashes might accidentally return one of those values. See
370 // https://crbug.com/503003. 369 // https://crbug.com/503003.
371 base::string16::size_type refpos = title.find('#'); 370 base::string16::size_type refpos = title.find('#');
372 base::string16::size_type querypos = title.find('?'); 371 base::string16::size_type querypos = title.find('?');
373 base::string16::size_type lastpos; 372 base::string16::size_type lastpos;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 return node; 777 return node;
779 } 778 }
780 // Enqueue any children and keep looking. 779 // Enqueue any children and keep looking.
781 for (auto& child : node->children) 780 for (auto& child : node->children)
782 work_queue.push(child); 781 work_queue.push(child);
783 } 782 }
784 return nullptr; 783 return nullptr;
785 } 784 }
786 785
787 } // namespace content 786 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.h ('k') | content/browser/frame_host/navigation_entry_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698