This source file includes following definitions.
- GetMaxWidth
- GetMaxWidth
- TrimTooltipText
#include "ui/views/widget/tooltip_manager.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/text_elider.h"
namespace views {
const size_t kMaxTooltipLength = 1024;
const char TooltipManager::kGroupingPropertyKey[] = "GroupingPropertyKey";
int TooltipManager::GetMaxWidth(int x, int y, gfx::NativeView context) {
return GetMaxWidth(gfx::Screen::GetScreenFor(context)->GetDisplayNearestPoint(
gfx::Point(x, y)));
}
int TooltipManager::GetMaxWidth(const gfx::Display& display) {
return (display.bounds().width() + 1) / 2;
}
void TooltipManager::TrimTooltipText(base::string16* text) {
*text = gfx::TruncateString(*text, kMaxTooltipLength);
}
}