| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { | 183 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { |
| 184 // Ignore mouse events that coincide with the last touch event. | 184 // Ignore mouse events that coincide with the last touch event. |
| 185 if (event->location() == last_touch_loc_) { | 185 if (event->location() == last_touch_loc_) { |
| 186 SetTooltipWindow(nullptr); | 186 SetTooltipWindow(nullptr); |
| 187 | 187 |
| 188 if (tooltip_->IsVisible()) | 188 if (tooltip_->IsVisible()) |
| 189 UpdateIfRequired(); | 189 UpdateIfRequired(); |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 // TODO: Wrap this up in the previous test. |
| 193 if ((event->flags() & ui::EF_FROM_TOUCH) || |
| 194 (event->flags() & ui::EF_IS_SYNTHESIZED) || |
| 195 (event->flags() & ui::EF_CURSOR_HIDDEN)) { |
| 196 SetTooltipWindow(nullptr); |
| 197 if (tooltip_->IsVisible()) |
| 198 UpdateIfRequired(); |
| 199 return; |
| 200 } |
| 192 switch (event->type()) { | 201 switch (event->type()) { |
| 193 case ui::ET_MOUSE_CAPTURE_CHANGED: | 202 case ui::ET_MOUSE_CAPTURE_CHANGED: |
| 194 case ui::ET_MOUSE_EXITED: | 203 case ui::ET_MOUSE_EXITED: |
| 195 case ui::ET_MOUSE_MOVED: | 204 case ui::ET_MOUSE_MOVED: |
| 196 case ui::ET_MOUSE_DRAGGED: { | 205 case ui::ET_MOUSE_DRAGGED: { |
| 197 curr_mouse_loc_ = event->location(); | 206 curr_mouse_loc_ = event->location(); |
| 198 aura::Window* target = NULL; | 207 aura::Window* target = NULL; |
| 199 // Avoid a call to display::Screen::GetWindowAtScreenPoint() since it can | 208 // Avoid a call to display::Screen::GetWindowAtScreenPoint() since it can |
| 200 // be very expensive on X11 in cases when the tooltip is hidden anyway. | 209 // be very expensive on X11 in cases when the tooltip is hidden anyway. |
| 201 if (tooltips_enabled_ && | 210 if (tooltips_enabled_ && |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return; | 395 return; |
| 387 if (tooltip_window_) | 396 if (tooltip_window_) |
| 388 tooltip_window_->RemoveObserver(this); | 397 tooltip_window_->RemoveObserver(this); |
| 389 tooltip_window_ = target; | 398 tooltip_window_ = target; |
| 390 if (tooltip_window_) | 399 if (tooltip_window_) |
| 391 tooltip_window_->AddObserver(this); | 400 tooltip_window_->AddObserver(this); |
| 392 } | 401 } |
| 393 | 402 |
| 394 } // namespace corewm | 403 } // namespace corewm |
| 395 } // namespace views | 404 } // namespace views |
| OLD | NEW |