OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/bookmark_bar_view.h" | 5 #include "chrome/browser/views/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const GURL& url, | 136 const GURL& url, |
137 const std::wstring& title, | 137 const std::wstring& title, |
138 const std::wstring& languages) { | 138 const std::wstring& languages) { |
139 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(), | 139 int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(), |
140 screen_loc.y()); | 140 screen_loc.y()); |
141 gfx::Font tt_font = views::TooltipManager::GetDefaultFont(); | 141 gfx::Font tt_font = views::TooltipManager::GetDefaultFont(); |
142 std::wstring result; | 142 std::wstring result; |
143 | 143 |
144 // First the title. | 144 // First the title. |
145 if (!title.empty()) { | 145 if (!title.empty()) { |
146 std::wstring localized_title; | 146 std::wstring localized_title = title; |
147 if (!base::i18n::AdjustStringForLocaleDirection(title, &localized_title)) | 147 base::i18n::AdjustStringForLocaleDirection(&localized_title); |
148 localized_title = title; | |
149 result.append(UTF16ToWideHack(gfx::ElideText(WideToUTF16Hack( | 148 result.append(UTF16ToWideHack(gfx::ElideText(WideToUTF16Hack( |
150 localized_title), tt_font, max_width, false))); | 149 localized_title), tt_font, max_width, false))); |
151 } | 150 } |
152 | 151 |
153 // Only show the URL if the url and title differ. | 152 // Only show the URL if the url and title differ. |
154 if (title != UTF8ToWide(url.spec())) { | 153 if (title != UTF8ToWide(url.spec())) { |
155 if (!result.empty()) | 154 if (!result.empty()) |
156 result.append(views::TooltipManager::GetLineSeparator()); | 155 result.append(views::TooltipManager::GetLineSeparator()); |
157 | 156 |
158 // We need to explicitly specify the directionality of the URL's text to | 157 // We need to explicitly specify the directionality of the URL's text to |
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 // The tooltip is the only way we have to display text explaining the error | 1733 // The tooltip is the only way we have to display text explaining the error |
1735 // to the user. | 1734 // to the user. |
1736 sync_error_button->SetTooltipText( | 1735 sync_error_button->SetTooltipText( |
1737 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1736 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
1738 sync_error_button->SetAccessibleName( | 1737 sync_error_button->SetAccessibleName( |
1739 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1738 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
1740 sync_error_button->SetIcon( | 1739 sync_error_button->SetIcon( |
1741 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1740 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
1742 return sync_error_button; | 1741 return sync_error_button; |
1743 } | 1742 } |
OLD | NEW |