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

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

Issue 267723008: Retires ui::TranslatedKeyEvent and replaces it with KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed AcceleratorControllerTest.MAYBE_ProcessOnce more. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « mojo/examples/launcher/launcher.cc ('k') | ui/events/event.cc » ('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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // TODO(msw): Additional work may be needed for analogues on other platforms. 549 // TODO(msw): Additional work may be needed for analogues on other platforms.
550 bool IsUnicodeKeyCode() const; 550 bool IsUnicodeKeyCode() const;
551 551
552 std::string code() const { return code_; } 552 std::string code() const { return code_; }
553 553
554 // Normalizes flags_ to make it Windows/Mac compatible. Since the way 554 // Normalizes flags_ to make it Windows/Mac compatible. Since the way
555 // of setting modifier mask on X is very different than Windows/Mac as shown 555 // of setting modifier mask on X is very different than Windows/Mac as shown
556 // in http://crbug.com/127142#c8, the normalization is necessary. 556 // in http://crbug.com/127142#c8, the normalization is necessary.
557 void NormalizeFlags(); 557 void NormalizeFlags();
558 558
559 // Returns true if the key event has already been processed by an input method
560 // and there is no need to pass the key event to the input method again.
561 bool IsTranslated() const;
562 // Marks this key event as translated or not translated.
563 void SetTranslated(bool translated);
564
559 protected: 565 protected:
560 // This allows a subclass TranslatedKeyEvent to be a non character event. 566 // This allows a subclass TranslatedKeyEvent to be a non character event.
561 void set_is_char(bool is_char) { is_char_ = is_char; } 567 void set_is_char(bool is_char) { is_char_ = is_char; }
562 568
563 private: 569 private:
564 KeyboardCode key_code_; 570 KeyboardCode key_code_;
565 571
566 // String of 'code' defined in DOM KeyboardEvent (e.g. 'KeyA', 'Space') 572 // String of 'code' defined in DOM KeyboardEvent (e.g. 'KeyA', 'Space')
567 // http://www.w3.org/TR/uievents/#keyboard-key-codes. 573 // http://www.w3.org/TR/uievents/#keyboard-key-codes.
568 // 574 //
569 // This value represents the physical position in the keyboard and can be 575 // This value represents the physical position in the keyboard and can be
570 // converted from / to keyboard scan code like XKB. 576 // converted from / to keyboard scan code like XKB.
571 std::string code_; 577 std::string code_;
572 578
573 // True if this is a translated character event (vs. a raw key down). Both 579 // True if this is a translated character event (vs. a raw key down). Both
574 // share the same type: ET_KEY_PRESSED. 580 // share the same type: ET_KEY_PRESSED.
575 bool is_char_; 581 bool is_char_;
576 582
577 uint16 character_; 583 uint16 character_;
578 }; 584 };
579 585
580 // A key event which is translated by an input method (IME).
581 // For example, if an IME receives a KeyEvent(VKEY_SPACE), and it does not
582 // consume the key, the IME usually generates and dispatches a
583 // TranslatedKeyEvent(VKEY_SPACE) event. If the IME receives a KeyEvent and
584 // it does consume the event, it might dispatch a
585 // TranslatedKeyEvent(VKEY_PROCESSKEY) event as defined in the DOM spec.
586 class EVENTS_EXPORT TranslatedKeyEvent : public KeyEvent {
587 public:
588 TranslatedKeyEvent(const base::NativeEvent& native_event, bool is_char);
589
590 // Used for synthetic events such as a VKEY_PROCESSKEY key event.
591 TranslatedKeyEvent(bool is_press, KeyboardCode key_code, int flags);
592
593 explicit TranslatedKeyEvent(const KeyEvent& key_event);
594
595 // Changes the type() of the object from ET_TRANSLATED_KEY_* to ET_KEY_* so
596 // that RenderWidgetHostViewAura and NativeWidgetAura could handle the event.
597 void ConvertToKeyEvent();
598
599 private:
600 DISALLOW_COPY_AND_ASSIGN(TranslatedKeyEvent);
601 };
602
603 class EVENTS_EXPORT ScrollEvent : public MouseEvent { 586 class EVENTS_EXPORT ScrollEvent : public MouseEvent {
604 public: 587 public:
605 explicit ScrollEvent(const base::NativeEvent& native_event); 588 explicit ScrollEvent(const base::NativeEvent& native_event);
606 template <class T> 589 template <class T>
607 ScrollEvent(const ScrollEvent& model, 590 ScrollEvent(const ScrollEvent& model,
608 T* source, 591 T* source,
609 T* target) 592 T* target)
610 : MouseEvent(model, source, target), 593 : MouseEvent(model, source, target),
611 x_offset_(model.x_offset_), 594 x_offset_(model.x_offset_),
612 y_offset_(model.y_offset_), 595 y_offset_(model.y_offset_),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 // The set of indices of ones in the binary representation of 665 // The set of indices of ones in the binary representation of
683 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. 666 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture.
684 // This value is stored as a bitfield because the number of touch ids varies, 667 // This value is stored as a bitfield because the number of touch ids varies,
685 // but we currently don't need more than 32 touches at a time. 668 // but we currently don't need more than 32 touches at a time.
686 const unsigned int touch_ids_bitfield_; 669 const unsigned int touch_ids_bitfield_;
687 }; 670 };
688 671
689 } // namespace ui 672 } // namespace ui
690 673
691 #endif // UI_EVENTS_EVENT_H_ 674 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « mojo/examples/launcher/launcher.cc ('k') | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698