| OLD | NEW |
| 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" |
| 11 #include "base/gtest_prod_util.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "ui/events/event_constants.h" | 14 #include "ui/events/event_constants.h" |
| 14 #include "ui/events/gesture_event_details.h" | 15 #include "ui/events/gesture_event_details.h" |
| 15 #include "ui/events/gestures/gesture_types.h" | 16 #include "ui/events/gestures/gesture_types.h" |
| 16 #include "ui/events/keycodes/keyboard_codes.h" | 17 #include "ui/events/keycodes/keyboard_codes.h" |
| 17 #include "ui/events/latency_info.h" | 18 #include "ui/events/latency_info.h" |
| 18 #include "ui/gfx/point.h" | 19 #include "ui/gfx/point.h" |
| 19 #include "ui/gfx/point_conversions.h" | 20 #include "ui/gfx/point_conversions.h" |
| 20 | 21 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 void SetClickCount(int click_count); | 384 void SetClickCount(int click_count); |
| 384 | 385 |
| 385 // Identifies the button that changed. During a press this corresponds to the | 386 // Identifies the button that changed. During a press this corresponds to the |
| 386 // button that was pressed and during a release this corresponds to the button | 387 // button that was pressed and during a release this corresponds to the button |
| 387 // that was released. | 388 // that was released. |
| 388 // NOTE: during a press and release flags() contains the complete set of | 389 // NOTE: during a press and release flags() contains the complete set of |
| 389 // flags. Use this to determine the button that was pressed or released. | 390 // flags. Use this to determine the button that was pressed or released. |
| 390 int changed_button_flags() const { return changed_button_flags_; } | 391 int changed_button_flags() const { return changed_button_flags_; } |
| 391 | 392 |
| 392 private: | 393 private: |
| 394 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); |
| 395 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); |
| 396 |
| 393 // Returns the repeat count based on the previous mouse click, if it is | 397 // Returns the repeat count based on the previous mouse click, if it is |
| 394 // recent enough and within a small enough distance. | 398 // recent enough and within a small enough distance. |
| 395 static int GetRepeatCount(const MouseEvent& click_event); | 399 static int GetRepeatCount(const MouseEvent& click_event); |
| 396 | 400 |
| 401 // Resets the last_click_event_ for unit tests. |
| 402 static void ResetLastClickForTest(); |
| 403 |
| 397 // See description above getter for details. | 404 // See description above getter for details. |
| 398 int changed_button_flags_; | 405 int changed_button_flags_; |
| 399 | 406 |
| 400 static MouseEvent* last_click_event_; | 407 static MouseEvent* last_click_event_; |
| 408 |
| 409 // We can create a MouseEvent for a native event more than once. We set this |
| 410 // to true when the next event either has a different timestamp or we see a |
| 411 // release signalling that the press (click) event was completed. |
| 412 static bool last_click_complete_; |
| 401 }; | 413 }; |
| 402 | 414 |
| 403 class ScrollEvent; | 415 class ScrollEvent; |
| 404 | 416 |
| 405 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { | 417 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { |
| 406 public: | 418 public: |
| 407 // See |offset| for details. | 419 // See |offset| for details. |
| 408 static const int kWheelDelta; | 420 static const int kWheelDelta; |
| 409 | 421 |
| 410 explicit MouseWheelEvent(const base::NativeEvent& native_event); | 422 explicit MouseWheelEvent(const base::NativeEvent& native_event); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // The set of indices of ones in the binary representation of | 697 // The set of indices of ones in the binary representation of |
| 686 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 698 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 687 // This value is stored as a bitfield because the number of touch ids varies, | 699 // This value is stored as a bitfield because the number of touch ids varies, |
| 688 // but we currently don't need more than 32 touches at a time. | 700 // but we currently don't need more than 32 touches at a time. |
| 689 const unsigned int touch_ids_bitfield_; | 701 const unsigned int touch_ids_bitfield_; |
| 690 }; | 702 }; |
| 691 | 703 |
| 692 } // namespace ui | 704 } // namespace ui |
| 693 | 705 |
| 694 #endif // UI_EVENTS_EVENT_H_ | 706 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |