summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/bookmark_bar_view.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 17:51:04 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 17:51:04 +0000
commit4fea07faa60c88589599bf60b33a36961be68491 (patch)
treee82d02260a590898641ffd7520cfd9e62c0c8764 /chrome/browser/views/bookmark_bar_view.cc
parent97afa066c572a1f56e0e8cbf1e93e8437a201eb7 (diff)
downloadchromium_src-4fea07faa60c88589599bf60b33a36961be68491.zip
chromium_src-4fea07faa60c88589599bf60b33a36961be68491.tar.gz
chromium_src-4fea07faa60c88589599bf60b33a36961be68491.tar.bz2
Fleshes out the tooltip implementation for views on Gtk. It doesn't
support explicit positioning of the tooltip as windows does. That'll have to be added later. BUG=none TEST=make sure tooltips still work correctly on windows Review URL: http://codereview.chromium.org/197031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_bar_view.cc')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc25
1 files changed, 5 insertions, 20 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 889e910..96dc4b7 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -43,11 +43,6 @@
#include "views/widget/widget.h"
#include "views/window/window.h"
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#include "base/base_drag_source.h"
-#endif
-
using views::CustomButton;
using views::DropTargetEvent;
using views::MenuButton;
@@ -141,13 +136,8 @@ static std::wstring CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
const GURL& url,
const std::wstring& title,
const std::wstring& languages) {
-#if defined(OS_WIN)
- gfx::Rect monitor_bounds = win_util::GetMonitorBoundsForRect(
- gfx::Rect(screen_loc.x(), screen_loc.y(), 1, 1));
-#else
- gfx::Rect monitor_bounds(0, 0, 10000, 10000);
- NOTIMPLEMENTED();
-#endif
+ int max_width = views::TooltipManager::GetMaxWidth(screen_loc.x(),
+ screen_loc.y());
gfx::Font tt_font = views::TooltipManager::GetDefaultFont();
std::wstring result;
@@ -155,11 +145,9 @@ static std::wstring CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
if (!title.empty()) {
std::wstring localized_title;
if (l10n_util::AdjustStringForLocaleDirection(title, &localized_title))
- result.append(gfx::ElideText(localized_title,
- tt_font,
- monitor_bounds.width()));
+ result.append(gfx::ElideText(localized_title, tt_font, max_width));
else
- result.append(gfx::ElideText(title, tt_font, monitor_bounds.width()));
+ result.append(gfx::ElideText(title, tt_font, max_width));
}
// Only show the URL if the url and title differ.
@@ -173,10 +161,7 @@ static std::wstring CreateToolTipForURLAndTitle(const gfx::Point& screen_loc,
// "/http://www.yahoo.com" when rendered, as is, in an RTL context since
// the Unicode BiDi algorithm puts certain characters on the left by
// default.
- std::wstring elided_url(gfx::ElideUrl(url,
- tt_font,
- monitor_bounds.width(),
- languages));
+ std::wstring elided_url(gfx::ElideUrl(url, tt_font, max_width, languages));
if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
l10n_util::WrapStringWithLTRFormatting(&elided_url);
result.append(elided_url);