OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 base::i18n::AdjustStringForLocaleDirection(&localized_title); | 706 base::i18n::AdjustStringForLocaleDirection(&localized_title); |
707 result.append(gfx::ElideText(localized_title, tt_fonts, max_width, | 707 result.append(gfx::ElideText(localized_title, tt_fonts, max_width, |
708 gfx::ELIDE_TAIL)); | 708 gfx::ELIDE_TAIL)); |
709 } | 709 } |
710 | 710 |
711 // Only show the URL if the url and title differ. | 711 // Only show the URL if the url and title differ. |
712 if (title != base::UTF8ToUTF16(url.spec())) { | 712 if (title != base::UTF8ToUTF16(url.spec())) { |
713 if (!result.empty()) | 713 if (!result.empty()) |
714 result.push_back('\n'); | 714 result.push_back('\n'); |
715 | 715 |
| 716 #if !defined(OS_ANDROID) |
716 // We need to explicitly specify the directionality of the URL's text to | 717 // We need to explicitly specify the directionality of the URL's text to |
717 // make sure it is treated as an LTR string when the context is RTL. For | 718 // make sure it is treated as an LTR string when the context is RTL. For |
718 // example, the URL "http://www.yahoo.com/" appears as | 719 // example, the URL "http://www.yahoo.com/" appears as |
719 // "/http://www.yahoo.com" when rendered, as is, in an RTL context since | 720 // "/http://www.yahoo.com" when rendered, as is, in an RTL context since |
720 // the Unicode BiDi algorithm puts certain characters on the left by | 721 // the Unicode BiDi algorithm puts certain characters on the left by |
721 // default. | 722 // default. |
722 std::string languages = profile->GetPrefs()->GetString( | 723 std::string languages = profile->GetPrefs()->GetString( |
723 prefs::kAcceptLanguages); | 724 prefs::kAcceptLanguages); |
724 base::string16 elided_url( | 725 base::string16 elided_url( |
725 url_formatter::ElideUrl(url, tt_fonts, max_width, languages)); | 726 url_formatter::ElideUrl(url, tt_fonts, max_width, languages)); |
726 elided_url = base::i18n::GetDisplayStringInLTRDirectionality(elided_url); | 727 elided_url = base::i18n::GetDisplayStringInLTRDirectionality(elided_url); |
727 result.append(elided_url); | 728 result.append(elided_url); |
| 729 #endif |
728 } | 730 } |
729 return result; | 731 return result; |
730 } | 732 } |
731 | 733 |
732 bool BookmarkBarView::IsDetached() const { | 734 bool BookmarkBarView::IsDetached() const { |
733 return (bookmark_bar_state_ == BookmarkBar::DETACHED) || | 735 return (bookmark_bar_state_ == BookmarkBar::DETACHED) || |
734 (animating_detached_ && size_animation_->is_animating()); | 736 (animating_detached_ && size_animation_->is_animating()); |
735 } | 737 } |
736 | 738 |
737 double BookmarkBarView::GetAnimationValue() const { | 739 double BookmarkBarView::GetAnimationValue() const { |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 return; | 2077 return; |
2076 apps_page_shortcut_->SetVisible(visible); | 2078 apps_page_shortcut_->SetVisible(visible); |
2077 UpdateBookmarksSeparatorVisibility(); | 2079 UpdateBookmarksSeparatorVisibility(); |
2078 LayoutAndPaint(); | 2080 LayoutAndPaint(); |
2079 } | 2081 } |
2080 | 2082 |
2081 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2083 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2082 if (UpdateOtherAndManagedButtonsVisibility()) | 2084 if (UpdateOtherAndManagedButtonsVisibility()) |
2083 LayoutAndPaint(); | 2085 LayoutAndPaint(); |
2084 } | 2086 } |
OLD | NEW |