| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/touch_exploration_controller.h" | 5 #include "ui/chromeos/touch_exploration_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 bool TouchExplorationController::IsInNoFingersDownStateForTesting() const { | 47 bool TouchExplorationController::IsInNoFingersDownStateForTesting() const { |
| 48 return state_ == NO_FINGERS_DOWN; | 48 return state_ == NO_FINGERS_DOWN; |
| 49 } | 49 } |
| 50 | 50 |
| 51 ui::EventRewriteStatus TouchExplorationController::RewriteEvent( | 51 ui::EventRewriteStatus TouchExplorationController::RewriteEvent( |
| 52 const ui::Event& event, | 52 const ui::Event& event, |
| 53 scoped_ptr<ui::Event>* rewritten_event) { | 53 scoped_ptr<ui::Event>* rewritten_event) { |
| 54 if (!event.IsTouchEvent()) { | 54 if (!event.IsTouchEvent()) { |
| 55 if (event.IsKeyEvent()) { | 55 if (event.IsKeyEvent()) { |
| 56 const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(event); | 56 const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(event); |
| 57 VLOG(0) << "\nKeyboard event: " << key_event.name() << "\n" | 57 VLOG(0) << "\nKeyboard event: " << key_event.name() |
| 58 << " Key code: " << key_event.key_code() | 58 << "\n Key code: " << key_event.key_code() |
| 59 << ", Flags: " << key_event.flags() | 59 << ", Flags: " << key_event.flags() |
| 60 << ", Is char: " << key_event.is_char(); | 60 << ", Is char: " << key_event.is_char(); |
| 61 } | 61 } |
| 62 if(event.IsGestureEvent()){ | 62 if(event.IsGestureEvent()){ |
| 63 VLOG(0) << "\n Gesture event " << event.name(); | 63 VLOG(0) << "\n Gesture event " << event.name(); |
| 64 } | 64 } |
| 65 return ui::EVENT_REWRITE_CONTINUE; | 65 return ui::EVENT_REWRITE_CONTINUE; |
| 66 } | 66 } |
| 67 const ui::TouchEvent& touch_event = static_cast<const ui::TouchEvent&>(event); | 67 const ui::TouchEvent& touch_event = static_cast<const ui::TouchEvent&>(event); |
| 68 | 68 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 VLOG_STATE(); | 222 VLOG_STATE(); |
| 223 return ui::EVENT_REWRITE_REWRITTEN; | 223 return ui::EVENT_REWRITE_REWRITTEN; |
| 224 } else if (type == ui::ET_TOUCH_RELEASED && !last_touch_exploration_) { | 224 } else if (type == ui::ET_TOUCH_RELEASED && !last_touch_exploration_) { |
| 225 // If the previous press was discarded, we need to also handle its | 225 // If the previous press was discarded, we need to also handle its |
| 226 // release. | 226 // release. |
| 227 if (current_touch_ids_.size() == 0) { | 227 if (current_touch_ids_.size() == 0) { |
| 228 state_ = NO_FINGERS_DOWN; | 228 state_ = NO_FINGERS_DOWN; |
| 229 } | 229 } |
| 230 return ui::EVENT_REWRITE_DISCARD; | 230 return ui::EVENT_REWRITE_DISCARD; |
| 231 } | 231 } |
| 232 NOTREACHED() << "Unexpected event type received.";; | 232 NOTREACHED() << "Unexpected event type received. " << event.name(); |
| 233 return ui::EVENT_REWRITE_CONTINUE; | 233 return ui::EVENT_REWRITE_CONTINUE; |
| 234 } | 234 } |
| 235 | 235 |
| 236 ui::EventRewriteStatus TouchExplorationController::InDoubleTapPressed( | 236 ui::EventRewriteStatus TouchExplorationController::InDoubleTapPressed( |
| 237 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { | 237 const ui::TouchEvent& event, scoped_ptr<ui::Event>* rewritten_event) { |
| 238 const ui::EventType type = event.type(); | 238 const ui::EventType type = event.type(); |
| 239 if (type == ui::ET_TOUCH_PRESSED) { | 239 if (type == ui::ET_TOUCH_PRESSED) { |
| 240 return ui::EVENT_REWRITE_DISCARD; | 240 return ui::EVENT_REWRITE_DISCARD; |
| 241 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { | 241 } else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) { |
| 242 if (current_touch_ids_.size() != 0) | 242 if (current_touch_ids_.size() != 0) |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 return "TWO_TO_ONE_FINGER"; | 554 return "TWO_TO_ONE_FINGER"; |
| 555 case PASSTHROUGH: | 555 case PASSTHROUGH: |
| 556 return "PASSTHROUGH"; | 556 return "PASSTHROUGH"; |
| 557 case WAIT_FOR_RELEASE: | 557 case WAIT_FOR_RELEASE: |
| 558 return "WAIT_FOR_RELEASE"; | 558 return "WAIT_FOR_RELEASE"; |
| 559 } | 559 } |
| 560 return "Not a state"; | 560 return "Not a state"; |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace ui | 563 } // namespace ui |
| OLD | NEW |