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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 391 |
391 // Identifies the button that changed. During a press this corresponds to the | 392 // Identifies the button that changed. During a press this corresponds to the |
392 // button that was pressed and during a release this corresponds to the button | 393 // button that was pressed and during a release this corresponds to the button |
393 // that was released. | 394 // that was released. |
394 // NOTE: during a press and release flags() contains the complete set of | 395 // NOTE: during a press and release flags() contains the complete set of |
395 // flags. Use this to determine the button that was pressed or released. | 396 // flags. Use this to determine the button that was pressed or released. |
396 int changed_button_flags() const { return changed_button_flags_; } | 397 int changed_button_flags() const { return changed_button_flags_; } |
397 void set_changed_button_flags(int flags) { changed_button_flags_ = flags; } | 398 void set_changed_button_flags(int flags) { changed_button_flags_ = flags; } |
398 | 399 |
399 private: | 400 private: |
| 401 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); |
| 402 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); |
| 403 |
400 // Returns the repeat count based on the previous mouse click, if it is | 404 // Returns the repeat count based on the previous mouse click, if it is |
401 // recent enough and within a small enough distance. | 405 // recent enough and within a small enough distance. |
402 static int GetRepeatCount(const MouseEvent& click_event); | 406 static int GetRepeatCount(const MouseEvent& click_event); |
403 | 407 |
| 408 // Resets the last_click_event_ for unit tests. |
| 409 static void ResetLastClickForTest(); |
| 410 |
404 // See description above getter for details. | 411 // See description above getter for details. |
405 int changed_button_flags_; | 412 int changed_button_flags_; |
406 | 413 |
407 static MouseEvent* last_click_event_; | 414 static MouseEvent* last_click_event_; |
| 415 |
| 416 // We can create a MouseEvent for a native event more than once. We set this |
| 417 // to true when the next event either has a different timestamp or we see a |
| 418 // release signalling that the press (click) event was completed. |
| 419 static bool last_click_complete_; |
408 }; | 420 }; |
409 | 421 |
410 class ScrollEvent; | 422 class ScrollEvent; |
411 | 423 |
412 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { | 424 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { |
413 public: | 425 public: |
414 // See |offset| for details. | 426 // See |offset| for details. |
415 static const int kWheelDelta; | 427 static const int kWheelDelta; |
416 | 428 |
417 explicit MouseWheelEvent(const base::NativeEvent& native_event); | 429 explicit MouseWheelEvent(const base::NativeEvent& native_event); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 690 |
679 const GestureEventDetails& details() const { return details_; } | 691 const GestureEventDetails& details() const { return details_; } |
680 | 692 |
681 private: | 693 private: |
682 GestureEventDetails details_; | 694 GestureEventDetails details_; |
683 }; | 695 }; |
684 | 696 |
685 } // namespace ui | 697 } // namespace ui |
686 | 698 |
687 #endif // UI_EVENTS_EVENT_H_ | 699 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |