Chromium Code Reviews| Index: ui/views/corewm/tooltip_controller.cc |
| diff --git a/ui/views/corewm/tooltip_controller.cc b/ui/views/corewm/tooltip_controller.cc |
| index 86e9fd6c87ae2d59b8bc94da8d23628da26a732f..2bce79fa38c3c9088a261b3ef5b54abb3104f665 100644 |
| --- a/ui/views/corewm/tooltip_controller.cc |
| +++ b/ui/views/corewm/tooltip_controller.cc |
| @@ -115,6 +115,7 @@ aura::Window* GetTooltipTarget(const ui::MouseEvent& event, |
| TooltipController::TooltipController(scoped_ptr<Tooltip> tooltip) |
| : tooltip_window_(NULL), |
| + tooltip_id_(NULL), |
| tooltip_window_at_mouse_press_(NULL), |
| tooltip_(tooltip.Pass()), |
| tooltips_enabled_(true) { |
| @@ -282,12 +283,23 @@ void TooltipController::UpdateIfRequired() { |
| tooltip_window_at_mouse_press_ = NULL; |
| } |
| + // If the uniqueness indicator is different from the previously encountered |
| + // one, we should force tooltip update |
| + const void* tooltip_id = aura::client::GetTooltipId(tooltip_window_); |
| + bool ids_differ = false; |
| + if (tooltip_id) { |
|
sky
2014/06/02 15:39:47
Why the if here? Can't you always compare tooltip_
|
| + ids_differ = tooltip_id_ != tooltip_id; |
| + tooltip_id_ = tooltip_id; |
| + } else { |
| + tooltip_id_ = NULL; |
| + } |
| + |
| // We add the !tooltip_->IsVisible() below because when we come here from |
| // TooltipTimerFired(), the tooltip_text may not have changed but we still |
| // want to update the tooltip because the timer has fired. |
| // If we come here from UpdateTooltip(), we have already checked for tooltip |
| // visibility and this check below will have no effect. |
| - if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible()) { |
| + if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible() || ids_differ) { |
| tooltip_shown_timer_.Stop(); |
| tooltip_text_ = tooltip_text; |
| base::string16 trimmed_text(tooltip_text_); |