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

Unified Diff: views/widget/tooltip_manager.cc

Issue 8598031: views: Move widget/ directory to ui/views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reland for real Created 9 years, 1 month 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 | « views/widget/tooltip_manager.h ('k') | views/widget/tooltip_manager_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/tooltip_manager.cc
diff --git a/views/widget/tooltip_manager.cc b/views/widget/tooltip_manager.cc
deleted file mode 100644
index 1d8b285f95ac6121b2510ea832bde1235eb11c17..0000000000000000000000000000000000000000
--- a/views/widget/tooltip_manager.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "views/widget/tooltip_manager.h"
-
-#include <vector>
-
-#include "base/string_split.h"
-#include "base/utf_string_conversions.h"
-#include "ui/base/text/text_elider.h"
-
-namespace {
-
-// Maximum number of characters we allow in a tooltip.
-const size_t kMaxTooltipLength = 1024;
-
-// Maximum number of lines we allow in the tooltip.
-const size_t kMaxLines = 6;
-
-} // namespace
-
-namespace views {
-
-// static
-void TooltipManager::TrimTooltipToFit(string16* text,
- int* max_width,
- int* line_count,
- int x,
- int y) {
- *max_width = 0;
- *line_count = 0;
-
- // Clamp the tooltip length to kMaxTooltipLength so that we don't
- // accidentally DOS the user with a mega tooltip.
- if (text->length() > kMaxTooltipLength)
- *text = text->substr(0, kMaxTooltipLength);
-
- // Determine the available width for the tooltip.
- int available_width = GetMaxWidth(x, y);
-
- // Split the string into at most kMaxLines lines.
- std::vector<string16> lines;
- base::SplitString(*text, '\n', &lines);
- if (lines.size() > kMaxLines)
- lines.resize(kMaxLines);
- *line_count = static_cast<int>(lines.size());
-
- // Format each line to fit.
- gfx::Font font = GetDefaultFont();
- string16 result;
- for (std::vector<string16>::iterator i = lines.begin(); i != lines.end();
- ++i) {
- string16 elided_text = ui::ElideText(*i, font, available_width, false);
- *max_width = std::max(*max_width, font.GetStringWidth(elided_text));
- if (!result.empty())
- result.push_back('\n');
- result.append(elided_text);
- }
- *text = result;
-}
-
-} // namespace views
« no previous file with comments | « views/widget/tooltip_manager.h ('k') | views/widget/tooltip_manager_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698