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 "ash/touch/touch_observer_hud.h" | 5 #include "ash/touch/touch_observer_hud.h" |
6 | 6 |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 bool TouchObserverHUD::PreHandleKeyEvent(aura::Window* target, | 185 bool TouchObserverHUD::PreHandleKeyEvent(aura::Window* target, |
186 ui::KeyEvent* event) { | 186 ui::KeyEvent* event) { |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 bool TouchObserverHUD::PreHandleMouseEvent(aura::Window* target, | 190 bool TouchObserverHUD::PreHandleMouseEvent(aura::Window* target, |
191 ui::MouseEvent* event) { | 191 ui::MouseEvent* event) { |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 ui::TouchStatus TouchObserverHUD::PreHandleTouchEvent( | 195 ui::EventResult TouchObserverHUD::PreHandleTouchEvent( |
196 aura::Window* target, | 196 aura::Window* target, |
197 ui::TouchEvent* event) { | 197 ui::TouchEvent* event) { |
198 if (event->touch_id() >= kMaxTouchPoints) | 198 if (event->touch_id() >= kMaxTouchPoints) |
199 return ui::TOUCH_STATUS_UNKNOWN; | 199 return ui::ER_UNHANDLED; |
200 | 200 |
201 if (event->type() != ui::ET_TOUCH_CANCELLED) | 201 if (event->type() != ui::ET_TOUCH_CANCELLED) |
202 touch_positions_[event->touch_id()] = event->root_location(); | 202 touch_positions_[event->touch_id()] = event->root_location(); |
203 if (event->type() == ui::ET_TOUCH_PRESSED) | 203 if (event->type() == ui::ET_TOUCH_PRESSED) |
204 canvas_->Start(event->touch_id(), touch_positions_[event->touch_id()]); | 204 canvas_->Start(event->touch_id(), touch_positions_[event->touch_id()]); |
205 else | 205 else |
206 canvas_->Update(event->touch_id(), touch_positions_[event->touch_id()]); | 206 canvas_->Update(event->touch_id(), touch_positions_[event->touch_id()]); |
207 touch_status_[event->touch_id()] = event->type(); | 207 touch_status_[event->touch_id()] = event->type(); |
208 touch_labels_[event->touch_id()]->SetVisible(true); | 208 touch_labels_[event->touch_id()]->SetVisible(true); |
209 UpdateTouchPointLabel(event->touch_id()); | 209 UpdateTouchPointLabel(event->touch_id()); |
210 | 210 |
211 widget_->SetSize(widget_->GetContentsView()->GetPreferredSize()); | 211 widget_->SetSize(widget_->GetContentsView()->GetPreferredSize()); |
212 | 212 |
213 return ui::TOUCH_STATUS_UNKNOWN; | 213 return ui::ER_UNHANDLED; |
214 } | 214 } |
215 | 215 |
216 ui::EventResult TouchObserverHUD::PreHandleGestureEvent( | 216 ui::EventResult TouchObserverHUD::PreHandleGestureEvent( |
217 aura::Window* target, | 217 aura::Window* target, |
218 ui::GestureEvent* event) { | 218 ui::GestureEvent* event) { |
219 return ui::ER_UNHANDLED; | 219 return ui::ER_UNHANDLED; |
220 } | 220 } |
221 | 221 |
222 void TouchObserverHUD::OnWidgetClosing(views::Widget* widget) { | 222 void TouchObserverHUD::OnWidgetClosing(views::Widget* widget) { |
223 DCHECK_EQ(widget, widget_); | 223 DCHECK_EQ(widget, widget_); |
224 widget_ = NULL; | 224 widget_ = NULL; |
225 } | 225 } |
226 | 226 |
227 } // namespace internal | 227 } // namespace internal |
228 } // namespace ash | 228 } // namespace ash |
OLD | NEW |