| 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" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // TODO(msw): Additional work may be needed for analogues on other platforms. | 559 // TODO(msw): Additional work may be needed for analogues on other platforms. |
| 560 bool IsUnicodeKeyCode() const; | 560 bool IsUnicodeKeyCode() const; |
| 561 | 561 |
| 562 std::string code() const { return code_; } | 562 std::string code() const { return code_; } |
| 563 | 563 |
| 564 // Normalizes flags_ to make it Windows/Mac compatible. Since the way | 564 // Normalizes flags_ to make it Windows/Mac compatible. Since the way |
| 565 // of setting modifier mask on X is very different than Windows/Mac as shown | 565 // of setting modifier mask on X is very different than Windows/Mac as shown |
| 566 // in http://crbug.com/127142#c8, the normalization is necessary. | 566 // in http://crbug.com/127142#c8, the normalization is necessary. |
| 567 void NormalizeFlags(); | 567 void NormalizeFlags(); |
| 568 | 568 |
| 569 protected: |
| 570 // This allows a subclass TranslatedKeyEvent to be a non character event. |
| 571 void set_is_char(bool is_char) { is_char_ = is_char; } |
| 572 |
| 569 private: | 573 private: |
| 570 KeyboardCode key_code_; | 574 KeyboardCode key_code_; |
| 571 | 575 |
| 572 // String of 'code' defined in DOM KeyboardEvent (e.g. 'KeyA', 'Space') | 576 // String of 'code' defined in DOM KeyboardEvent (e.g. 'KeyA', 'Space') |
| 573 // http://www.w3.org/TR/uievents/#keyboard-key-codes. | 577 // http://www.w3.org/TR/uievents/#keyboard-key-codes. |
| 574 // | 578 // |
| 575 // This value represents the physical position in the keyboard and can be | 579 // This value represents the physical position in the keyboard and can be |
| 576 // converted from / to keyboard scan code like XKB. | 580 // converted from / to keyboard scan code like XKB. |
| 577 std::string code_; | 581 std::string code_; |
| 578 | 582 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 589 // TranslatedKeyEvent(VKEY_SPACE) event. If the IME receives a KeyEvent and | 593 // TranslatedKeyEvent(VKEY_SPACE) event. If the IME receives a KeyEvent and |
| 590 // it does consume the event, it might dispatch a | 594 // it does consume the event, it might dispatch a |
| 591 // TranslatedKeyEvent(VKEY_PROCESSKEY) event as defined in the DOM spec. | 595 // TranslatedKeyEvent(VKEY_PROCESSKEY) event as defined in the DOM spec. |
| 592 class EVENTS_EXPORT TranslatedKeyEvent : public KeyEvent { | 596 class EVENTS_EXPORT TranslatedKeyEvent : public KeyEvent { |
| 593 public: | 597 public: |
| 594 TranslatedKeyEvent(const base::NativeEvent& native_event, bool is_char); | 598 TranslatedKeyEvent(const base::NativeEvent& native_event, bool is_char); |
| 595 | 599 |
| 596 // Used for synthetic events such as a VKEY_PROCESSKEY key event. | 600 // Used for synthetic events such as a VKEY_PROCESSKEY key event. |
| 597 TranslatedKeyEvent(bool is_press, KeyboardCode key_code, int flags); | 601 TranslatedKeyEvent(bool is_press, KeyboardCode key_code, int flags); |
| 598 | 602 |
| 603 explicit TranslatedKeyEvent(const KeyEvent& key_event); |
| 604 |
| 599 // Changes the type() of the object from ET_TRANSLATED_KEY_* to ET_KEY_* so | 605 // Changes the type() of the object from ET_TRANSLATED_KEY_* to ET_KEY_* so |
| 600 // that RenderWidgetHostViewAura and NativeWidgetAura could handle the event. | 606 // that RenderWidgetHostViewAura and NativeWidgetAura could handle the event. |
| 601 void ConvertToKeyEvent(); | 607 void ConvertToKeyEvent(); |
| 602 | 608 |
| 603 private: | 609 private: |
| 604 DISALLOW_COPY_AND_ASSIGN(TranslatedKeyEvent); | 610 DISALLOW_COPY_AND_ASSIGN(TranslatedKeyEvent); |
| 605 }; | 611 }; |
| 606 | 612 |
| 607 class EVENTS_EXPORT ScrollEvent : public MouseEvent { | 613 class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
| 608 public: | 614 public: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 // The set of indices of ones in the binary representation of | 692 // The set of indices of ones in the binary representation of |
| 687 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 693 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 688 // This value is stored as a bitfield because the number of touch ids varies, | 694 // This value is stored as a bitfield because the number of touch ids varies, |
| 689 // but we currently don't need more than 32 touches at a time. | 695 // but we currently don't need more than 32 touches at a time. |
| 690 const unsigned int touch_ids_bitfield_; | 696 const unsigned int touch_ids_bitfield_; |
| 691 }; | 697 }; |
| 692 | 698 |
| 693 } // namespace ui | 699 } // namespace ui |
| 694 | 700 |
| 695 #endif // UI_EVENTS_EVENT_H_ | 701 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |