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/shelf/shelf_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
6 | 6 |
7 #include "ash/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) { | 168 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) { |
169 if (!shelf_layout_manager_ || shelf_layout_manager_->IsVisible()) { | 169 if (!shelf_layout_manager_ || shelf_layout_manager_->IsVisible()) { |
170 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_), | 170 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_), |
171 base::Bind(&ShelfTooltipManager::ShowTooltip, | 171 base::Bind(&ShelfTooltipManager::ShowTooltip, |
172 weak_factory_.GetWeakPtr(), view)); | 172 weak_factory_.GetWeakPtr(), view)); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void ShelfTooltipManager::OnMousePressed(const ui::MouseEvent& event, | 176 void ShelfTooltipManager::OnMousePressObserved( |
177 const gfx::Point& location_in_screen, | 177 const ui::MouseEvent& event, |
178 views::Widget* target) { | 178 const gfx::Point& location_in_screen, |
| 179 views::Widget* target) { |
179 // Close on any mouse press events inside or outside the tooltip. | 180 // Close on any mouse press events inside or outside the tooltip. |
180 Close(); | 181 Close(); |
181 } | 182 } |
182 | 183 |
183 void ShelfTooltipManager::OnTouchPressed(const ui::TouchEvent& event, | 184 void ShelfTooltipManager::OnTouchPressObserved( |
184 const gfx::Point& location_in_screen, | 185 const ui::TouchEvent& event, |
185 views::Widget* target) { | 186 const gfx::Point& location_in_screen, |
| 187 views::Widget* target) { |
186 // Close on any touch press events inside or outside the tooltip. | 188 // Close on any touch press events inside or outside the tooltip. |
187 Close(); | 189 Close(); |
188 } | 190 } |
189 | 191 |
| 192 void ShelfTooltipManager::OnTouchReleaseObserved( |
| 193 const ui::TouchEvent& event, |
| 194 const gfx::Point& location_in_screen, |
| 195 views::Widget* target) {} |
| 196 |
| 197 void ShelfTooltipManager::OnTouchMoveObserved( |
| 198 const ui::TouchEvent& event, |
| 199 const gfx::Point& location_in_screen, |
| 200 views::Widget* target) {} |
| 201 |
| 202 void ShelfTooltipManager::OnTouchCancellObserved( |
| 203 const ui::TouchEvent& event, |
| 204 const gfx::Point& location_in_screen, |
| 205 views::Widget* target) {} |
| 206 |
190 void ShelfTooltipManager::OnEvent(ui::Event* event) { | 207 void ShelfTooltipManager::OnEvent(ui::Event* event) { |
191 // Mouse and touch press events are handled via views::PointerWatcher. | 208 // Mouse and touch press events are handled via views::PointerWatcher. |
192 if (event->type() == ui::ET_MOUSE_PRESSED || | 209 if (event->type() == ui::ET_MOUSE_PRESSED || |
193 event->type() == ui::ET_TOUCH_PRESSED) { | 210 event->type() == ui::ET_TOUCH_PRESSED) { |
194 return; | 211 return; |
195 } | 212 } |
196 | 213 |
197 if (event->type() == ui::ET_MOUSE_EXITED || !event->IsMouseEvent() || | 214 if (event->type() == ui::ET_MOUSE_EXITED || !event->IsMouseEvent() || |
198 event->target() != shelf_view_->GetWidget()->GetNativeWindow()) { | 215 event->target() != shelf_view_->GetWidget()->GetNativeWindow()) { |
199 if (!event->IsKeyEvent()) | 216 if (!event->IsKeyEvent()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // AutoHide state change happens during an event filter, so immediate close | 262 // AutoHide state change happens during an event filter, so immediate close |
246 // may cause a crash in the HandleMouseEvent() after the filter. So we just | 263 // may cause a crash in the HandleMouseEvent() after the filter. So we just |
247 // schedule the Close here. | 264 // schedule the Close here. |
248 base::ThreadTaskRunnerHandle::Get()->PostTask( | 265 base::ThreadTaskRunnerHandle::Get()->PostTask( |
249 FROM_HERE, | 266 FROM_HERE, |
250 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); | 267 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); |
251 } | 268 } |
252 } | 269 } |
253 | 270 |
254 } // namespace ash | 271 } // namespace ash |
OLD | NEW |