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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 switch (event->type()) { | 271 switch (event->type()) { |
272 case ui::ET_MOUSE_EXITED: | 272 case ui::ET_MOUSE_EXITED: |
273 target = NULL; | 273 target = NULL; |
274 // Fall through. | 274 // Fall through. |
275 case ui::ET_MOUSE_MOVED: | 275 case ui::ET_MOUSE_MOVED: |
276 case ui::ET_MOUSE_DRAGGED: | 276 case ui::ET_MOUSE_DRAGGED: |
277 if (tooltip_window_ != target) { | 277 if (tooltip_window_ != target) { |
278 if (tooltip_window_) | 278 if (tooltip_window_) |
279 tooltip_window_->RemoveObserver(this); | 279 tooltip_window_->RemoveObserver(this); |
280 tooltip_window_ = target; | 280 tooltip_window_ = target; |
281 if (tooltip_window_) | 281 if (tooltip_window_) { |
282 tooltip_window_->AddObserver(this); | 282 tooltip_window_->AddObserver(this); |
| 283 } else { |
| 284 // If the tooltip_window_ is reparented then we need to recreate the |
| 285 // tooltip to ensure that it shows up correctly. |
| 286 tooltip_.reset(NULL); |
| 287 } |
283 } | 288 } |
284 curr_mouse_loc_ = event->location(); | 289 curr_mouse_loc_ = event->location(); |
285 if (tooltip_timer_.IsRunning()) | 290 if (tooltip_timer_.IsRunning()) |
286 tooltip_timer_.Reset(); | 291 tooltip_timer_.Reset(); |
287 | 292 |
288 if (GetTooltip()->IsVisible()) | 293 if (GetTooltip()->IsVisible()) |
289 UpdateIfRequired(); | 294 UpdateIfRequired(); |
290 break; | 295 break; |
291 case ui::ET_MOUSE_PRESSED: | 296 case ui::ET_MOUSE_PRESSED: |
292 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) { | 297 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 int TooltipController::GetTooltipShownTimeout() { | 551 int TooltipController::GetTooltipShownTimeout() { |
547 std::map<aura::Window*, int>::const_iterator it = | 552 std::map<aura::Window*, int>::const_iterator it = |
548 tooltip_shown_timeout_map_.find(tooltip_window_); | 553 tooltip_shown_timeout_map_.find(tooltip_window_); |
549 if (it == tooltip_shown_timeout_map_.end()) | 554 if (it == tooltip_shown_timeout_map_.end()) |
550 return kDefaultTooltipShownTimeoutMs; | 555 return kDefaultTooltipShownTimeoutMs; |
551 return it->second; | 556 return it->second; |
552 } | 557 } |
553 | 558 |
554 } // namespace corewm | 559 } // namespace corewm |
555 } // namespace views | 560 } // namespace views |
OLD | NEW |