summaryrefslogtreecommitdiffstats
path: root/ui/chromeos
diff options
context:
space:
mode:
authorevy@chromium.org <evy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:40:41 +0000
committerevy@chromium.org <evy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:40:41 +0000
commitb208f96775c3fa1a3b4696a1d80b8db216fc7a4e (patch)
treed63e82d7d409d73b179d1006aff134755a80839d /ui/chromeos
parenta6a89c928bde116e3df71122263fcef43cefb7da (diff)
downloadchromium_src-b208f96775c3fa1a3b4696a1d80b8db216fc7a4e.zip
chromium_src-b208f96775c3fa1a3b4696a1d80b8db216fc7a4e.tar.gz
chromium_src-b208f96775c3fa1a3b4696a1d80b8db216fc7a4e.tar.bz2
Added more detailed and useful VLOGs to touch_exploration_controller.
This will help to help debug features we are currently working on. BUG=377040 Review URL: https://codereview.chromium.org/339573004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/chromeos')
-rw-r--r--ui/chromeos/touch_exploration_controller.cc74
-rw-r--r--ui/chromeos/touch_exploration_controller.h2
2 files changed, 36 insertions, 40 deletions
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 9763cae..e800001 100644
--- a/ui/chromeos/touch_exploration_controller.cc
+++ b/ui/chromeos/touch_exploration_controller.cc
@@ -44,6 +44,7 @@ TouchExplorationController::TouchExplorationController(
root_window->GetHost()->GetEventSource()->AddEventRewriter(this);
}
+
TouchExplorationController::~TouchExplorationController() {
root_window_->GetHost()->GetEventSource()->RemoveEventRewriter(this);
}
@@ -66,10 +67,20 @@ bool TouchExplorationController::IsInNoFingersDownStateForTesting() const {
ui::EventRewriteStatus TouchExplorationController::RewriteEvent(
const ui::Event& event,
scoped_ptr<ui::Event>* rewritten_event) {
- if (!event.IsTouchEvent())
+ if (!event.IsTouchEvent()) {
+ if (event.IsKeyEvent()) {
+ const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(event);
+ VLOG(0) << "\nKeyboard event: " << key_event.name() << "\n"
+ << " Key code: " << key_event.key_code()
+ << ", Flags: " << key_event.flags()
+ << ", Is char: " << key_event.is_char();
+ }
+ if(event.IsGestureEvent()){
+ VLOG(0) << "\n Gesture event " << event.name();
+ }
return ui::EVENT_REWRITE_CONTINUE;
- const ui::TouchEvent& touch_event =
- static_cast<const ui::TouchEvent&>(event);
+ }
+ const ui::TouchEvent& touch_event = static_cast<const ui::TouchEvent&>(event);
// If the tap timer should have fired by now but hasn't, run it now and
// stop the timer. This is important so that behavior is consistent with
@@ -133,7 +144,6 @@ ui::EventRewriteStatus TouchExplorationController::RewriteEvent(
case TOUCH_EXPLORE_SECOND_PRESS:
return InTouchExploreSecondPress(touch_event, rewritten_event);
}
-
NOTREACHED();
return ui::EVENT_REWRITE_CONTINUE;
}
@@ -157,7 +167,6 @@ ui::EventRewriteStatus TouchExplorationController::InNoFingersDown(
VLOG_STATE();
return ui::EVENT_REWRITE_DISCARD;
}
-
NOTREACHED();
return ui::EVENT_REWRITE_CONTINUE;
}
@@ -190,7 +199,6 @@ ui::EventRewriteStatus TouchExplorationController::InSingleTapPressed(
VLOG_STATE();
return InTouchExploration(event, rewritten_event);
}
-
return EVENT_REWRITE_DISCARD;
}
NOTREACHED() << "Unexpected event type received.";
@@ -333,7 +341,7 @@ ui::EventRewriteStatus TouchExplorationController::InPassthroughMinusOne(
(*rewritten_event)->set_flags(event.flags());
return ui::EVENT_REWRITE_REWRITTEN;
}
-
+ NOTREACHED();
return ui::EVENT_REWRITE_CONTINUE;
}
@@ -412,7 +420,6 @@ void TouchExplorationController::DispatchEvent(ui::Event* event) {
event_handler_for_testing_->OnEvent(event);
return;
}
-
ui::EventDispatchDetails result ALLOW_UNUSED =
root_window_->GetHost()->dispatcher()->OnEventFromSource(event);
}
@@ -458,19 +465,28 @@ void TouchExplorationController::VlogState(const char* function_name) {
void TouchExplorationController::VlogEvent(const ui::TouchEvent& touch_event,
const char* function_name) {
CHECK(touch_event.IsTouchEvent());
- if (prev_event_ == NULL || prev_event_->type() != touch_event.type() ||
- prev_event_->touch_id() != touch_event.touch_id()) {
- const std::string type = EnumEventTypeToString(touch_event.type());
- const gfx::PointF& location = touch_event.location_f();
- const int touch_id = touch_event.touch_id();
-
- VLOG(0) << "\n Function name: " << function_name
- << "\n Event Type: " << type
- << "\n Location: " << location.ToString()
- << "\n Touch ID: " << touch_id
- << "\n Number of fingers down: " << current_touch_ids_.size();
- prev_event_.reset(new TouchEvent(touch_event));
+ if (prev_event_ != NULL &&
+ prev_event_->type() == touch_event.type() &&
+ prev_event_->touch_id() == touch_event.touch_id()){
+ return;
}
+ // The above statement prevents events of the same type and id from being
+ // printed in a row. However, if two fingers are down, they would both be
+ // moving and alternating printing move events unless we check for this.
+ if (prev_event_ != NULL &&
+ prev_event_->type() == ET_TOUCH_MOVED &&
+ touch_event.type() == ET_TOUCH_MOVED){
+ return;
+ }
+ const std::string& type = touch_event.name();
+ const gfx::PointF& location = touch_event.location_f();
+ const int touch_id = touch_event.touch_id();
+
+ VLOG(0) << "\n Function name: " << function_name
+ << "\n Event Type: " << type
+ << "\n Location: " << location.ToString()
+ << "\n Touch ID: " << touch_id;
+ prev_event_.reset(new TouchEvent(touch_event));
}
const char* TouchExplorationController::EnumStateToString(State state) {
@@ -495,22 +511,4 @@ const char* TouchExplorationController::EnumStateToString(State state) {
return "Not a state";
}
-std::string TouchExplorationController::EnumEventTypeToString(
- ui::EventType type) {
- // Add more cases later. For now, these are the most frequently seen
- // event types.
- switch (type) {
- case ET_TOUCH_RELEASED:
- return "ET_TOUCH_RELEASED";
- case ET_TOUCH_PRESSED:
- return "ET_TOUCH_PRESSED";
- case ET_TOUCH_MOVED:
- return "ET_TOUCH_MOVED";
- case ET_TOUCH_CANCELLED:
- return "ET_TOUCH_CANCELLED";
- default:
- return base::IntToString(type);
- }
-}
-
} // namespace ui
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index aa09928..6a1a59a7 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -194,8 +194,6 @@ class UI_CHROMEOS_EXPORT TouchExplorationController :
// Gets enum name from integer value.
const char* EnumStateToString(State state);
- std::string EnumEventTypeToString(ui::EventType type);
-
aura::Window* root_window_;
// A set of touch ids for fingers currently touching the screen.