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

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

Issue 183853011: Move TrimWhitespace to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/views/controls/styled_label.cc ('k') | win8/delegate_execute/delegate_execute_util.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_controller.h" 5 #include "ui/views/corewm/tooltip_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // If we come here from UpdateTooltip(), we have already checked for tooltip 281 // If we come here from UpdateTooltip(), we have already checked for tooltip
282 // visibility and this check below will have no effect. 282 // visibility and this check below will have no effect.
283 if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible()) { 283 if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible()) {
284 tooltip_shown_timer_.Stop(); 284 tooltip_shown_timer_.Stop();
285 tooltip_text_ = tooltip_text; 285 tooltip_text_ = tooltip_text;
286 base::string16 trimmed_text(tooltip_text_); 286 base::string16 trimmed_text(tooltip_text_);
287 views::TooltipManager::TrimTooltipText(&trimmed_text); 287 views::TooltipManager::TrimTooltipText(&trimmed_text);
288 // If the string consists entirely of whitespace, then don't both showing it 288 // If the string consists entirely of whitespace, then don't both showing it
289 // (an empty tooltip is useless). 289 // (an empty tooltip is useless).
290 base::string16 whitespace_removed_text; 290 base::string16 whitespace_removed_text;
291 TrimWhitespace(trimmed_text, TRIM_ALL, &whitespace_removed_text); 291 base::TrimWhitespace(trimmed_text, base::TRIM_ALL,
292 &whitespace_removed_text);
292 if (whitespace_removed_text.empty()) { 293 if (whitespace_removed_text.empty()) {
293 tooltip_->Hide(); 294 tooltip_->Hide();
294 } else { 295 } else {
295 gfx::Point widget_loc = curr_mouse_loc_ + 296 gfx::Point widget_loc = curr_mouse_loc_ +
296 tooltip_window_->GetBoundsInScreen().OffsetFromOrigin(); 297 tooltip_window_->GetBoundsInScreen().OffsetFromOrigin();
297 tooltip_->SetText(tooltip_window_, whitespace_removed_text, widget_loc); 298 tooltip_->SetText(tooltip_window_, whitespace_removed_text, widget_loc);
298 tooltip_->Show(); 299 tooltip_->Show();
299 int timeout = GetTooltipShownTimeout(); 300 int timeout = GetTooltipShownTimeout();
300 if (timeout > 0) { 301 if (timeout > 0) {
301 tooltip_shown_timer_.Start(FROM_HERE, 302 tooltip_shown_timer_.Start(FROM_HERE,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return; 344 return;
344 if (tooltip_window_) 345 if (tooltip_window_)
345 tooltip_window_->RemoveObserver(this); 346 tooltip_window_->RemoveObserver(this);
346 tooltip_window_ = target; 347 tooltip_window_ = target;
347 if (tooltip_window_) 348 if (tooltip_window_)
348 tooltip_window_->AddObserver(this); 349 tooltip_window_->AddObserver(this);
349 } 350 }
350 351
351 } // namespace corewm 352 } // namespace corewm
352 } // namespace views 353 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/styled_label.cc ('k') | win8/delegate_execute/delegate_execute_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698