Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: ui/events/event.h

Issue 785753002: Don't refcount tracking id -> slot id mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix uninitialized memory issue. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef UI_EVENTS_EVENT_H_ 5 #ifndef UI_EVENTS_EVENT_H_
6 #define UI_EVENTS_EVENT_H_ 6 #define UI_EVENTS_EVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/event_types.h" 10 #include "base/event_types.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // the target or post-target handlers. 217 // the target or post-target handlers.
218 // Note that SetHandled() can be called only for cancelable events. 218 // Note that SetHandled() can be called only for cancelable events.
219 void SetHandled(); 219 void SetHandled();
220 bool handled() const { return result_ != ER_UNHANDLED; } 220 bool handled() const { return result_ != ER_UNHANDLED; }
221 221
222 protected: 222 protected:
223 Event(EventType type, base::TimeDelta time_stamp, int flags); 223 Event(EventType type, base::TimeDelta time_stamp, int flags);
224 Event(const base::NativeEvent& native_event, EventType type, int flags); 224 Event(const base::NativeEvent& native_event, EventType type, int flags);
225 Event(const Event& copy); 225 Event(const Event& copy);
226 void SetType(EventType type); 226 void SetType(EventType type);
227 void set_delete_native_event(bool delete_native_event) {
228 delete_native_event_ = delete_native_event;
229 }
230 void set_cancelable(bool cancelable) { cancelable_ = cancelable; } 227 void set_cancelable(bool cancelable) { cancelable_ = cancelable; }
231 228
232 void set_time_stamp(const base::TimeDelta& time_stamp) { 229 void set_time_stamp(const base::TimeDelta& time_stamp) {
233 time_stamp_ = time_stamp; 230 time_stamp_ = time_stamp;
234 } 231 }
235 232
236 void set_name(const std::string& name) { name_ = name; } 233 void set_name(const std::string& name) { name_ = name; }
237 234
238 private: 235 private:
239 friend class EventTestApi; 236 friend class EventTestApi;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // Create a new TouchEvent which is identical to the provided model. 482 // Create a new TouchEvent which is identical to the provided model.
486 // If source / target windows are provided, the model location will be 483 // If source / target windows are provided, the model location will be
487 // converted from |source| coordinate system to |target| coordinate system. 484 // converted from |source| coordinate system to |target| coordinate system.
488 template <class T> 485 template <class T>
489 TouchEvent(const TouchEvent& model, T* source, T* target) 486 TouchEvent(const TouchEvent& model, T* source, T* target)
490 : LocatedEvent(model, source, target), 487 : LocatedEvent(model, source, target),
491 touch_id_(model.touch_id_), 488 touch_id_(model.touch_id_),
492 radius_x_(model.radius_x_), 489 radius_x_(model.radius_x_),
493 radius_y_(model.radius_y_), 490 radius_y_(model.radius_y_),
494 rotation_angle_(model.rotation_angle_), 491 rotation_angle_(model.rotation_angle_),
495 force_(model.force_) { 492 force_(model.force_),
496 } 493 should_remove_native_touch_id_mapping_(false) {}
497 494
498 TouchEvent(EventType type, 495 TouchEvent(EventType type,
499 const gfx::PointF& location, 496 const gfx::PointF& location,
500 int touch_id, 497 int touch_id,
501 base::TimeDelta time_stamp); 498 base::TimeDelta time_stamp);
502 499
503 TouchEvent(EventType type, 500 TouchEvent(EventType type,
504 const gfx::PointF& location, 501 const gfx::PointF& location,
505 int flags, 502 int flags,
506 int touch_id, 503 int touch_id,
507 base::TimeDelta timestamp, 504 base::TimeDelta timestamp,
508 float radius_x, 505 float radius_x,
509 float radius_y, 506 float radius_y,
510 float angle, 507 float angle,
511 float force); 508 float force);
512 509
513 ~TouchEvent() override; 510 ~TouchEvent() override;
514 511
515 int touch_id() const { return touch_id_; } 512 int touch_id() const { return touch_id_; }
516 float radius_x() const { return radius_x_; } 513 float radius_x() const { return radius_x_; }
517 float radius_y() const { return radius_y_; } 514 float radius_y() const { return radius_y_; }
518 float rotation_angle() const { return rotation_angle_; } 515 float rotation_angle() const { return rotation_angle_; }
519 float force() const { return force_; } 516 float force() const { return force_; }
520 517
521 // Used for unit tests. 518 // Used for unit tests.
522 void set_radius_x(const float r) { radius_x_ = r; } 519 void set_radius_x(const float r) { radius_x_ = r; }
523 void set_radius_y(const float r) { radius_y_ = r; } 520 void set_radius_y(const float r) { radius_y_ = r; }
524 521
522 void set_should_remove_native_touch_id_mapping(
523 bool should_remove_native_touch_id_mapping) {
524 should_remove_native_touch_id_mapping_ =
525 should_remove_native_touch_id_mapping;
526 }
527
525 // Overridden from LocatedEvent. 528 // Overridden from LocatedEvent.
526 void UpdateForRootTransform( 529 void UpdateForRootTransform(
527 const gfx::Transform& inverted_root_transform) override; 530 const gfx::Transform& inverted_root_transform) override;
528 531
529 protected: 532 protected:
530 void set_radius(float radius_x, float radius_y) { 533 void set_radius(float radius_x, float radius_y) {
531 radius_x_ = radius_x; 534 radius_x_ = radius_x;
532 radius_y_ = radius_y; 535 radius_y_ = radius_y;
533 } 536 }
534 537
(...skipping 12 matching lines...) Expand all
547 float radius_x_; 550 float radius_x_;
548 551
549 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 552 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
550 float radius_y_; 553 float radius_y_;
551 554
552 // Angle of the major axis away from the X axis. Default 0.0. 555 // Angle of the major axis away from the X axis. Default 0.0.
553 float rotation_angle_; 556 float rotation_angle_;
554 557
555 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. 558 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
556 float force_; 559 float force_;
560
561 // True if this event should remove the mapping between the native
562 // event id and the chromium touch id. This should only be the case
563 // for release and cancel events where the associated touch press
564 // event created a mapping between the native id and the chromium
565 // touch id.
566 bool should_remove_native_touch_id_mapping_;
557 }; 567 };
558 568
559 // An interface that individual platforms can use to store additional data on 569 // An interface that individual platforms can use to store additional data on
560 // KeyEvent. 570 // KeyEvent.
561 // 571 //
562 // Currently only used in mojo. 572 // Currently only used in mojo.
563 class EVENTS_EXPORT ExtendedKeyEventData { 573 class EVENTS_EXPORT ExtendedKeyEventData {
564 public: 574 public:
565 virtual ~ExtendedKeyEventData() {} 575 virtual ~ExtendedKeyEventData() {}
566 576
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 820
811 const GestureEventDetails& details() const { return details_; } 821 const GestureEventDetails& details() const { return details_; }
812 822
813 private: 823 private:
814 GestureEventDetails details_; 824 GestureEventDetails details_;
815 }; 825 };
816 826
817 } // namespace ui 827 } // namespace ui
818 828
819 #endif // UI_EVENTS_EVENT_H_ 829 #endif // UI_EVENTS_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698