| 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/touch/touch_hud_debug.h" | 5 #include "ash/touch/touch_hud_debug.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 bool active() const { | 154 bool active() const { |
| 155 return !log_.empty() && log_.back().type != ui::ET_TOUCH_RELEASED && | 155 return !log_.empty() && log_.back().type != ui::ET_TOUCH_RELEASED && |
| 156 log_.back().type != ui::ET_TOUCH_CANCELLED; | 156 log_.back().type != ui::ET_TOUCH_CANCELLED; |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Returns a list containing data from all events for the touch point. | 159 // Returns a list containing data from all events for the touch point. |
| 160 std::unique_ptr<base::ListValue> GetAsList() const { | 160 std::unique_ptr<base::ListValue> GetAsList() const { |
| 161 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 161 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 162 for (const_iterator i = log_.begin(); i != log_.end(); ++i) | 162 for (const_iterator i = log_.begin(); i != log_.end(); ++i) |
| 163 list->Append((*i).GetAsDictionary().release()); | 163 list->Append((*i).GetAsDictionary()); |
| 164 return list; | 164 return list; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void Reset() { | 167 void Reset() { |
| 168 log_.clear(); | 168 log_.clear(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 std::vector<TouchPointLog> log_; | 172 std::vector<TouchPointLog> log_; |
| 173 | 173 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 189 void Reset() { | 189 void Reset() { |
| 190 next_trace_index_ = 0; | 190 next_trace_index_ = 0; |
| 191 for (int i = 0; i < kMaxPaths; ++i) | 191 for (int i = 0; i < kMaxPaths; ++i) |
| 192 traces_[i].Reset(); | 192 traces_[i].Reset(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 std::unique_ptr<base::ListValue> GetAsList() const { | 195 std::unique_ptr<base::ListValue> GetAsList() const { |
| 196 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 196 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 197 for (int i = 0; i < kMaxPaths; ++i) { | 197 for (int i = 0; i < kMaxPaths; ++i) { |
| 198 if (!traces_[i].log().empty()) | 198 if (!traces_[i].log().empty()) |
| 199 list->Append(traces_[i].GetAsList().release()); | 199 list->Append(traces_[i].GetAsList()); |
| 200 } | 200 } |
| 201 return list; | 201 return list; |
| 202 } | 202 } |
| 203 | 203 |
| 204 int GetTraceIndex(int touch_id) const { | 204 int GetTraceIndex(int touch_id) const { |
| 205 return touch_id_to_trace_index_.at(touch_id); | 205 return touch_id_to_trace_index_.at(touch_id); |
| 206 } | 206 } |
| 207 | 207 |
| 208 const TouchTrace* traces() const { | 208 const TouchTrace* traces() const { |
| 209 return traces_; | 209 return traces_; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 RootWindowController* controller) { | 473 RootWindowController* controller) { |
| 474 controller->set_touch_hud_debug(this); | 474 controller->set_touch_hud_debug(this); |
| 475 } | 475 } |
| 476 | 476 |
| 477 void TouchHudDebug::UnsetHudForRootWindowController( | 477 void TouchHudDebug::UnsetHudForRootWindowController( |
| 478 RootWindowController* controller) { | 478 RootWindowController* controller) { |
| 479 controller->set_touch_hud_debug(NULL); | 479 controller->set_touch_hud_debug(NULL); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace ash | 482 } // namespace ash |
| OLD | NEW |