| OLD | NEW |
| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 void TooltipController::UpdateIfRequired() { | 262 void TooltipController::UpdateIfRequired() { |
| 263 if (!tooltips_enabled_ || | 263 if (!tooltips_enabled_ || |
| 264 aura::Env::GetInstance()->IsMouseButtonDown() || | 264 aura::Env::GetInstance()->IsMouseButtonDown() || |
| 265 IsDragDropInProgress() || !IsCursorVisible()) { | 265 IsDragDropInProgress() || !IsCursorVisible()) { |
| 266 tooltip_->Hide(); | 266 tooltip_->Hide(); |
| 267 return; | 267 return; |
| 268 } | 268 } |
| 269 | 269 |
| 270 string16 tooltip_text; | 270 base::string16 tooltip_text; |
| 271 if (tooltip_window_) | 271 if (tooltip_window_) |
| 272 tooltip_text = aura::client::GetTooltipText(tooltip_window_); | 272 tooltip_text = aura::client::GetTooltipText(tooltip_window_); |
| 273 | 273 |
| 274 // If the user pressed a mouse button. We will hide the tooltip and not show | 274 // If the user pressed a mouse button. We will hide the tooltip and not show |
| 275 // it until there is a change in the tooltip. | 275 // it until there is a change in the tooltip. |
| 276 if (tooltip_window_at_mouse_press_) { | 276 if (tooltip_window_at_mouse_press_) { |
| 277 if (tooltip_window_ == tooltip_window_at_mouse_press_ && | 277 if (tooltip_window_ == tooltip_window_at_mouse_press_ && |
| 278 tooltip_text == tooltip_text_at_mouse_press_) { | 278 tooltip_text == tooltip_text_at_mouse_press_) { |
| 279 tooltip_->Hide(); | 279 tooltip_->Hide(); |
| 280 return; | 280 return; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 int TooltipController::GetTooltipShownTimeout() { | 340 int TooltipController::GetTooltipShownTimeout() { |
| 341 std::map<aura::Window*, int>::const_iterator it = | 341 std::map<aura::Window*, int>::const_iterator it = |
| 342 tooltip_shown_timeout_map_.find(tooltip_window_); | 342 tooltip_shown_timeout_map_.find(tooltip_window_); |
| 343 if (it == tooltip_shown_timeout_map_.end()) | 343 if (it == tooltip_shown_timeout_map_.end()) |
| 344 return kDefaultTooltipShownTimeoutMs; | 344 return kDefaultTooltipShownTimeoutMs; |
| 345 return it->second; | 345 return it->second; |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace corewm | 348 } // namespace corewm |
| 349 } // namespace views | 349 } // namespace views |
| OLD | NEW |