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

Side by Side Diff: ui/views/corewm/tooltip_aura.cc

Issue 381953002: New avatar button: Consolidate text elision between Mac and Win/Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | ui/views/widget/tooltip_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/corewm/tooltip_aura.h" 5 #include "ui/views/corewm/tooltip_aura.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/aura/window_tree_host.h" 9 #include "ui/aura/window_tree_host.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 line.append(word); 110 line.append(word);
111 } 111 }
112 result_lines.push_back(line); 112 result_lines.push_back(line);
113 } 113 }
114 114
115 // Clamp number of lines to |kMaxLines|. 115 // Clamp number of lines to |kMaxLines|.
116 if (result_lines.size() > kMaxLines) { 116 if (result_lines.size() > kMaxLines) {
117 result_lines.resize(kMaxLines); 117 result_lines.resize(kMaxLines);
118 // Add ellipses character to last line. 118 // Add ellipses character to last line.
119 result_lines[kMaxLines - 1] = gfx::TruncateString( 119 result_lines[kMaxLines - 1] = gfx::TruncateString(
120 result_lines.back(), result_lines.back().length() - 1); 120 result_lines.back(), result_lines.back().length() - 1, gfx::WORD_BREAK);
121 } 121 }
122 *line_count = result_lines.size(); 122 *line_count = result_lines.size();
123 123
124 // Flatten the result. 124 // Flatten the result.
125 base::string16 result; 125 base::string16 result;
126 for (std::vector<base::string16>::iterator l = result_lines.begin(); 126 for (std::vector<base::string16>::iterator l = result_lines.begin();
127 l != result_lines.end(); ++l) { 127 l != result_lines.end(); ++l) {
128 if (!result.empty()) 128 if (!result.empty())
129 result.push_back('\n'); 129 result.push_back('\n');
130 int line_width = gfx::GetStringWidth(*l, font_list); 130 int line_width = gfx::GetStringWidth(*l, font_list);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { 238 void TooltipAura::OnWidgetDestroying(views::Widget* widget) {
239 DCHECK_EQ(widget_, widget); 239 DCHECK_EQ(widget_, widget);
240 widget_ = NULL; 240 widget_ = NULL;
241 tooltip_window_ = NULL; 241 tooltip_window_ = NULL;
242 } 242 }
243 243
244 } // namespace corewm 244 } // namespace corewm
245 } // namespace views 245 } // namespace views
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | ui/views/widget/tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698