| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/common/shelf/shelf_tooltip_manager.h" | 5 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
| 10 #include "ash/common/wm_root_window_controller.h" | 10 #include "ash/common/wm_root_window_controller.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 | 192 |
| 193 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) { | 193 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) { |
| 194 if (ShouldShowTooltipForView(view)) { | 194 if (ShouldShowTooltipForView(view)) { |
| 195 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_), | 195 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_), |
| 196 base::Bind(&ShelfTooltipManager::ShowTooltip, | 196 base::Bind(&ShelfTooltipManager::ShowTooltip, |
| 197 weak_factory_.GetWeakPtr(), view)); | 197 weak_factory_.GetWeakPtr(), view)); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ShelfTooltipManager::OnMousePressed(const ui::MouseEvent& event, | 201 void ShelfTooltipManager::OnPointerWatcherEvent( |
| 202 const gfx::Point& location_in_screen, | 202 const ui::PointerEvent& event, |
| 203 views::Widget* target) { | 203 const gfx::Point& location_in_screen, |
| 204 // Close on any mouse press events inside or outside the tooltip. | 204 views::Widget* target) { |
| 205 Close(); | 205 // Close on any press events inside or outside the tooltip. |
| 206 } | 206 if (event.type() == ui::ET_POINTER_DOWN) |
| 207 | 207 Close(); |
| 208 void ShelfTooltipManager::OnTouchPressed(const ui::TouchEvent& event, | |
| 209 const gfx::Point& location_in_screen, | |
| 210 views::Widget* target) { | |
| 211 // Close on any touch press events inside or outside the tooltip. | |
| 212 Close(); | |
| 213 } | 208 } |
| 214 | 209 |
| 215 void ShelfTooltipManager::OnMouseEvent(ui::MouseEvent* event) { | 210 void ShelfTooltipManager::OnMouseEvent(ui::MouseEvent* event) { |
| 216 if (event->type() == ui::ET_MOUSE_EXITED) { | 211 if (event->type() == ui::ET_MOUSE_EXITED) { |
| 217 Close(); | 212 Close(); |
| 218 return; | 213 return; |
| 219 } | 214 } |
| 220 | 215 |
| 221 if (event->type() != ui::ET_MOUSE_MOVED) | 216 if (event->type() != ui::ET_MOUSE_MOVED) |
| 222 return; | 217 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 252 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); | 247 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); |
| 253 } | 248 } |
| 254 } | 249 } |
| 255 | 250 |
| 256 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { | 251 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { |
| 257 return shelf_view_ && shelf_view_->ShouldShowTooltipForView(view) && | 252 return shelf_view_ && shelf_view_->ShouldShowTooltipForView(view) && |
| 258 shelf_view_->wm_shelf()->GetVisibilityState() == SHELF_VISIBLE; | 253 shelf_view_->wm_shelf()->GetVisibilityState() == SHELF_VISIBLE; |
| 259 } | 254 } |
| 260 | 255 |
| 261 } // namespace ash | 256 } // namespace ash |
| OLD | NEW |