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

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

Issue 2176463002: Default page title (the page's URL) is now in an LTR embedding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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 | « no previous file | content/browser/frame_host/navigation_entry_impl_unittest.cc » ('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 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>
11 11
12 #include "base/debug/dump_without_crashing.h" 12 #include "base/debug/dump_without_crashing.h"
13 #include "base/i18n/rtl.h"
13 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "components/url_formatter/url_formatter.h" 19 #include "components/url_formatter/url_formatter.h"
19 #include "content/common/content_constants_internal.h" 20 #include "content/common/content_constants_internal.h"
20 #include "content/common/navigation_params.h" 21 #include "content/common/navigation_params.h"
21 #include "content/common/page_state_serialization.h" 22 #include "content/common/page_state_serialization.h"
22 #include "content/common/resource_request_body_impl.h" 23 #include "content/common/resource_request_body_impl.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 base::string16::size_type lastpos; 412 base::string16::size_type lastpos;
412 if (refpos == base::string16::npos) 413 if (refpos == base::string16::npos)
413 lastpos = querypos; 414 lastpos = querypos;
414 else if (querypos == base::string16::npos) 415 else if (querypos == base::string16::npos)
415 lastpos = refpos; 416 lastpos = refpos;
416 else 417 else
417 lastpos = (refpos < querypos) ? refpos : querypos; 418 lastpos = (refpos < querypos) ? refpos : querypos;
418 base::string16::size_type slashpos = title.rfind('/', lastpos); 419 base::string16::size_type slashpos = title.rfind('/', lastpos);
419 if (slashpos != base::string16::npos) 420 if (slashpos != base::string16::npos)
420 title = title.substr(slashpos + 1); 421 title = title.substr(slashpos + 1);
422 } else if (base::i18n::StringContainsStrongRTLChars(title)) {
423 // Wrap the URL in an LTR embedding for proper handling of RTL characters.
424 // (RFC 3987 Section 4.1 states that "Bidirectional IRIs MUST be rendered in
425 // the same way as they would be if they were in a left-to-right
426 // embedding".)
427 base::i18n::WrapStringWithLTRFormatting(&title);
421 } 428 }
422 429
423 gfx::ElideString(title, kMaxTitleChars, &cached_display_title_); 430 gfx::ElideString(title, kMaxTitleChars, &cached_display_title_);
424 return cached_display_title_; 431 return cached_display_title_;
425 } 432 }
426 433
427 bool NavigationEntryImpl::IsViewSourceMode() const { 434 bool NavigationEntryImpl::IsViewSourceMode() const {
428 return virtual_url_.SchemeIs(kViewSourceScheme); 435 return virtual_url_.SchemeIs(kViewSourceScheme);
429 } 436 }
430 437
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 return node; 832 return node;
826 833
827 // Enqueue any children and keep looking. 834 // Enqueue any children and keep looking.
828 for (auto* child : node->children) 835 for (auto* child : node->children)
829 work_queue.push(child); 836 work_queue.push(child);
830 } 837 }
831 return nullptr; 838 return nullptr;
832 } 839 }
833 840
834 } // namespace content 841 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698