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

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

Issue 667923002: Standardize usage of virtual/override/final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « ui/events/device_data_manager.h ('k') | ui/events/event_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 EventResult result_; 249 EventResult result_;
250 250
251 // The device id the event came from, or ED_UNKNOWN_DEVICE if the information 251 // The device id the event came from, or ED_UNKNOWN_DEVICE if the information
252 // is not available. 252 // is not available.
253 int source_device_id_; 253 int source_device_id_;
254 }; 254 };
255 255
256 class EVENTS_EXPORT CancelModeEvent : public Event { 256 class EVENTS_EXPORT CancelModeEvent : public Event {
257 public: 257 public:
258 CancelModeEvent(); 258 CancelModeEvent();
259 virtual ~CancelModeEvent(); 259 ~CancelModeEvent() override;
260 }; 260 };
261 261
262 class EVENTS_EXPORT LocatedEvent : public Event { 262 class EVENTS_EXPORT LocatedEvent : public Event {
263 public: 263 public:
264 virtual ~LocatedEvent(); 264 ~LocatedEvent() override;
265 265
266 float x() const { return location_.x(); } 266 float x() const { return location_.x(); }
267 float y() const { return location_.y(); } 267 float y() const { return location_.y(); }
268 void set_location(const gfx::PointF& location) { location_ = location; } 268 void set_location(const gfx::PointF& location) { location_ = location; }
269 // TODO(tdresser): Always return floating point location. See 269 // TODO(tdresser): Always return floating point location. See
270 // crbug.com/337824. 270 // crbug.com/337824.
271 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } 271 gfx::Point location() const { return gfx::ToFlooredPoint(location_); }
272 const gfx::PointF& location_f() const { return location_; } 272 const gfx::PointF& location_f() const { return location_; }
273 void set_root_location(const gfx::PointF& root_location) { 273 void set_root_location(const gfx::PointF& root_location) {
274 root_location_ = root_location; 274 root_location_ = root_location;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 int flags, 462 int flags,
463 int changed_button_flags); 463 int changed_button_flags);
464 464
465 // The amount to scroll. This is in multiples of kWheelDelta. 465 // The amount to scroll. This is in multiples of kWheelDelta.
466 // Note: x_offset() > 0/y_offset() > 0 means scroll left/up. 466 // Note: x_offset() > 0/y_offset() > 0 means scroll left/up.
467 int x_offset() const { return offset_.x(); } 467 int x_offset() const { return offset_.x(); }
468 int y_offset() const { return offset_.y(); } 468 int y_offset() const { return offset_.y(); }
469 const gfx::Vector2d& offset() const { return offset_; } 469 const gfx::Vector2d& offset() const { return offset_; }
470 470
471 // Overridden from LocatedEvent. 471 // Overridden from LocatedEvent.
472 virtual void UpdateForRootTransform( 472 void UpdateForRootTransform(
473 const gfx::Transform& inverted_root_transform) override; 473 const gfx::Transform& inverted_root_transform) override;
474 474
475 private: 475 private:
476 gfx::Vector2d offset_; 476 gfx::Vector2d offset_;
477 }; 477 };
478 478
479 class EVENTS_EXPORT TouchEvent : public LocatedEvent { 479 class EVENTS_EXPORT TouchEvent : public LocatedEvent {
480 public: 480 public:
481 explicit TouchEvent(const base::NativeEvent& native_event); 481 explicit TouchEvent(const base::NativeEvent& native_event);
482 482
(...skipping 18 matching lines...) Expand all
501 TouchEvent(EventType type, 501 TouchEvent(EventType type,
502 const gfx::PointF& location, 502 const gfx::PointF& location,
503 int flags, 503 int flags,
504 int touch_id, 504 int touch_id,
505 base::TimeDelta timestamp, 505 base::TimeDelta timestamp,
506 float radius_x, 506 float radius_x,
507 float radius_y, 507 float radius_y,
508 float angle, 508 float angle,
509 float force); 509 float force);
510 510
511 virtual ~TouchEvent(); 511 ~TouchEvent() override;
512 512
513 int touch_id() const { return touch_id_; } 513 int touch_id() const { return touch_id_; }
514 float radius_x() const { return radius_x_; } 514 float radius_x() const { return radius_x_; }
515 float radius_y() const { return radius_y_; } 515 float radius_y() const { return radius_y_; }
516 float rotation_angle() const { return rotation_angle_; } 516 float rotation_angle() const { return rotation_angle_; }
517 float force() const { return force_; } 517 float force() const { return force_; }
518 518
519 // Used for unit tests. 519 // Used for unit tests.
520 void set_radius_x(const float r) { radius_x_ = r; } 520 void set_radius_x(const float r) { radius_x_ = r; }
521 void set_radius_y(const float r) { radius_y_ = r; } 521 void set_radius_y(const float r) { radius_y_ = r; }
522 522
523 // Overridden from LocatedEvent. 523 // Overridden from LocatedEvent.
524 virtual void UpdateForRootTransform( 524 void UpdateForRootTransform(
525 const gfx::Transform& inverted_root_transform) override; 525 const gfx::Transform& inverted_root_transform) override;
526 526
527 protected: 527 protected:
528 void set_radius(float radius_x, float radius_y) { 528 void set_radius(float radius_x, float radius_y) {
529 radius_x_ = radius_x; 529 radius_x_ = radius_x;
530 radius_y_ = radius_y; 530 radius_y_ = radius_y;
531 } 531 }
532 532
533 void set_rotation_angle(float rotation_angle) { 533 void set_rotation_angle(float rotation_angle) {
534 rotation_angle_ = rotation_angle; 534 rotation_angle_ = rotation_angle;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // See also: ui/events/keycodes/dom4/keycode_converter_data.h 608 // See also: ui/events/keycodes/dom4/keycode_converter_data.h
609 KeyEvent(EventType type, 609 KeyEvent(EventType type,
610 KeyboardCode key_code, 610 KeyboardCode key_code,
611 const std::string& code, 611 const std::string& code,
612 int flags); 612 int flags);
613 613
614 KeyEvent(const KeyEvent& rhs); 614 KeyEvent(const KeyEvent& rhs);
615 615
616 KeyEvent& operator=(const KeyEvent& rhs); 616 KeyEvent& operator=(const KeyEvent& rhs);
617 617
618 virtual ~KeyEvent(); 618 ~KeyEvent() override;
619 619
620 // TODO(erg): While we transition to mojo, we have to hack around a mismatch 620 // TODO(erg): While we transition to mojo, we have to hack around a mismatch
621 // in our event types. Our ui::Events don't really have all the data we need 621 // in our event types. Our ui::Events don't really have all the data we need
622 // to process key events, and we instead do per-platform conversions with 622 // to process key events, and we instead do per-platform conversions with
623 // native HWNDs or XEvents. And we can't reliably send those native data 623 // native HWNDs or XEvents. And we can't reliably send those native data
624 // types across mojo types in a cross-platform way. So instead, we set the 624 // types across mojo types in a cross-platform way. So instead, we set the
625 // resulting data when read across IPC boundaries. 625 // resulting data when read across IPC boundaries.
626 void SetExtendedKeyEventData(scoped_ptr<ExtendedKeyEventData> data); 626 void SetExtendedKeyEventData(scoped_ptr<ExtendedKeyEventData> data);
627 const ExtendedKeyEventData* extended_key_event_data() const { 627 const ExtendedKeyEventData* extended_key_event_data() const {
628 return extended_key_event_data_.get(); 628 return extended_key_event_data_.get();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 // Create a new GestureEvent which is identical to the provided model. 796 // Create a new GestureEvent which is identical to the provided model.
797 // If source / target windows are provided, the model location will be 797 // If source / target windows are provided, the model location will be
798 // converted from |source| coordinate system to |target| coordinate system. 798 // converted from |source| coordinate system to |target| coordinate system.
799 template <typename T> 799 template <typename T>
800 GestureEvent(const GestureEvent& model, T* source, T* target) 800 GestureEvent(const GestureEvent& model, T* source, T* target)
801 : LocatedEvent(model, source, target), 801 : LocatedEvent(model, source, target),
802 details_(model.details_) { 802 details_(model.details_) {
803 } 803 }
804 804
805 virtual ~GestureEvent(); 805 ~GestureEvent() override;
806 806
807 const GestureEventDetails& details() const { return details_; } 807 const GestureEventDetails& details() const { return details_; }
808 808
809 private: 809 private:
810 GestureEventDetails details_; 810 GestureEventDetails details_;
811 }; 811 };
812 812
813 } // namespace ui 813 } // namespace ui
814 814
815 #endif // UI_EVENTS_EVENT_H_ 815 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « ui/events/device_data_manager.h ('k') | ui/events/event_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698