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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 8917011: Change signature of |ui::ElideText()|. Add a truncate mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 Profile* profile) { 525 Profile* profile) {
526 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(), 526 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(),
527 screen_loc.y()); 527 screen_loc.y());
528 gfx::Font tt_font = views::TooltipManager::GetDefaultFont(); 528 gfx::Font tt_font = views::TooltipManager::GetDefaultFont();
529 string16 result; 529 string16 result;
530 530
531 // First the title. 531 // First the title.
532 if (!title.empty()) { 532 if (!title.empty()) {
533 string16 localized_title = title; 533 string16 localized_title = title;
534 base::i18n::AdjustStringForLocaleDirection(&localized_title); 534 base::i18n::AdjustStringForLocaleDirection(&localized_title);
535 result.append(ui::ElideText(localized_title, tt_font, max_width, false)); 535 result.append(ui::ElideText(localized_title, tt_font, max_width,
536 ui::ELIDE_AT_END));
536 } 537 }
537 538
538 // Only show the URL if the url and title differ. 539 // Only show the URL if the url and title differ.
539 if (title != UTF8ToUTF16(url.spec())) { 540 if (title != UTF8ToUTF16(url.spec())) {
540 if (!result.empty()) 541 if (!result.empty())
541 result.push_back('\n'); 542 result.push_back('\n');
542 543
543 // We need to explicitly specify the directionality of the URL's text to 544 // We need to explicitly specify the directionality of the URL's text to
544 // make sure it is treated as an LTR string when the context is RTL. For 545 // make sure it is treated as an LTR string when the context is RTL. For
545 // example, the URL "http://www.yahoo.com/" appears as 546 // example, the URL "http://www.yahoo.com/" appears as
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 (1 - size_animation_->GetCurrentValue()))); 1657 (1 - size_animation_->GetCurrentValue())));
1657 } else { 1658 } else {
1658 prefsize.set_height( 1659 prefsize.set_height(
1659 static_cast<int>( 1660 static_cast<int>(
1660 browser_defaults::kBookmarkBarHeight * 1661 browser_defaults::kBookmarkBarHeight *
1661 size_animation_->GetCurrentValue())); 1662 size_animation_->GetCurrentValue()));
1662 } 1663 }
1663 } 1664 }
1664 return prefsize; 1665 return prefsize;
1665 } 1666 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc ('k') | printing/print_settings_initializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698