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 } | |
288 } | 283 } |
289 curr_mouse_loc_ = event->location(); | 284 curr_mouse_loc_ = event->location(); |
290 if (tooltip_timer_.IsRunning()) | 285 if (tooltip_timer_.IsRunning()) |
291 tooltip_timer_.Reset(); | 286 tooltip_timer_.Reset(); |
292 | 287 |
293 if (GetTooltip()->IsVisible()) | 288 if (GetTooltip()->IsVisible()) |
294 UpdateIfRequired(); | 289 UpdateIfRequired(); |
295 break; | 290 break; |
296 case ui::ET_MOUSE_PRESSED: | 291 case ui::ET_MOUSE_PRESSED: |
297 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) { | 292 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) { |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 int TooltipController::GetTooltipShownTimeout() { | 546 int TooltipController::GetTooltipShownTimeout() { |
552 std::map<aura::Window*, int>::const_iterator it = | 547 std::map<aura::Window*, int>::const_iterator it = |
553 tooltip_shown_timeout_map_.find(tooltip_window_); | 548 tooltip_shown_timeout_map_.find(tooltip_window_); |
554 if (it == tooltip_shown_timeout_map_.end()) | 549 if (it == tooltip_shown_timeout_map_.end()) |
555 return kDefaultTooltipShownTimeoutMs; | 550 return kDefaultTooltipShownTimeoutMs; |
556 return it->second; | 551 return it->second; |
557 } | 552 } |
558 | 553 |
559 } // namespace corewm | 554 } // namespace corewm |
560 } // namespace views | 555 } // namespace views |
OLD | NEW |