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

Unified Diff: ui/aura_shell/shell_tooltip_manager.cc

Issue 8888037: Windows component build fix for aura. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/views/test/test_tooltip_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/shell_tooltip_manager.cc
diff --git a/ui/aura_shell/shell_tooltip_manager.cc b/ui/aura_shell/shell_tooltip_manager.cc
index ac8fa5449e743aa046bb740a10b9638c3cb636a7..3f38eda7d31eac409eaa1184d3438a908a214393 100644
--- a/ui/aura_shell/shell_tooltip_manager.cc
+++ b/ui/aura_shell/shell_tooltip_manager.cc
@@ -48,6 +48,21 @@ const size_t kMaxTooltipLength = 1024;
// Maximum number of lines we allow in the tooltip.
const size_t kMaxLines = 6;
+gfx::Font GetDefaultFont() {
+ // TODO(varunjain): implementation duplicated in tooltip_manager_aura. Figure
+ // out a way to merge.
+ return ui::ResourceBundle::GetSharedInstance().GetFont(
+ ui::ResourceBundle::BaseFont);
+}
+
+int GetMaxWidth(int x, int y) {
+ // TODO(varunjain): implementation duplicated in tooltip_manager_aura. Figure
+ // out a way to merge.
+ gfx::Rect monitor_bounds =
+ gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y));
+ return (monitor_bounds.width() + 1) / 2;
+}
+
// Trims the tooltip to fit, setting |text| to the clipped result,
// |max_width| to the width (in pixels) of the clipped text and |line_count|
// to the number of lines of text in the tooltip. |x| and |y| give the
@@ -66,7 +81,7 @@ void TrimTooltipToFit(string16* text,
*text = text->substr(0, kMaxTooltipLength);
// Determine the available width for the tooltip.
- int available_width = aura::TooltipClient::GetMaxWidth(x, y);
+ int available_width = GetMaxWidth(x, y);
// Split the string into at most kMaxLines lines.
std::vector<string16> lines;
@@ -76,7 +91,7 @@ void TrimTooltipToFit(string16* text,
*line_count = static_cast<int>(lines.size());
// Format each line to fit.
- gfx::Font font = aura::TooltipClient::GetDefaultFont();
+ gfx::Font font = GetDefaultFont();
string16 result;
for (std::vector<string16>::iterator i = lines.begin(); i != lines.end();
++i) {
@@ -279,20 +294,3 @@ void ShellTooltipManager::UpdateIfRequired() {
}
} // namespace aura_shell
-
-namespace aura {
-
-// static
-gfx::Font TooltipClient::GetDefaultFont() {
- return ui::ResourceBundle::GetSharedInstance().GetFont(
- ui::ResourceBundle::BaseFont);
-}
-
-// static
-int TooltipClient::GetMaxWidth(int x, int y) {
- gfx::Rect monitor_bounds =
- gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y));
- return (monitor_bounds.width() + 1) / 2;
-}
-
-} // namespace aura
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/views/test/test_tooltip_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698