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

Unified Diff: ui/views/corewm/tooltip_win.cc

Issue 916423002: Tooltip Cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win build fix Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/corewm/tooltip_win.h ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/tooltip_win.cc
diff --git a/ui/views/corewm/tooltip_win.cc b/ui/views/corewm/tooltip_win.cc
index 15d90acebf82fb3a1e78868fde6841b7dd9c12d5..46635d2ba5d137b818eabf946bd582bb6a8b82e4 100644
--- a/ui/views/corewm/tooltip_win.cc
+++ b/ui/views/corewm/tooltip_win.cc
@@ -95,6 +95,16 @@ void TooltipWin::PositionTooltip() {
0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
+int TooltipWin::GetMaxWidth(const gfx::Point& location,
+ aura::Window* context) const {
+ // This code only runs for non-metro, so GetNativeScreen() is fine.
+ const gfx::Point screen_point = gfx::win::DIPToScreenPoint(location);
+ gfx::Display display(
+ gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint(screen_point));
+ const gfx::Rect monitor_bounds = display.bounds();
+ return (monitor_bounds.width() + 1) / 2;
+}
+
void TooltipWin::SetText(aura::Window* window,
const base::string16& tooltip_text,
const gfx::Point& location) {
@@ -116,12 +126,7 @@ void TooltipWin::SetText(aura::Window* window,
SendMessage(tooltip_hwnd_, TTM_SETTOOLINFO, 0,
reinterpret_cast<LPARAM>(&toolinfo_));
- // This code only runs for non-metro, so GetNativeScreen() is fine.
- const gfx::Point screen_point = gfx::win::DIPToScreenPoint(location_);
- gfx::Display display(
- gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint(screen_point));
- const gfx::Rect monitor_bounds = display.bounds();
- int max_width = (monitor_bounds.width() + 1) / 2;
+ int max_width = GetMaxWidth(location_, window);
SendMessage(tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0, max_width);
}
« no previous file with comments | « ui/views/corewm/tooltip_win.h ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698