 Chromium Code Reviews
 Chromium Code Reviews Issue 354063003:
  View should store a ViewTargeter instead of an EventTargeter  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 354063003:
  View should store a ViewTargeter instead of an EventTargeter  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ | 
| 6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ | 
| 7 | 7 | 
| 8 #include <algorithm> | 8 #include <algorithm> | 
| 9 #include <map> | 9 #include <map> | 
| 10 #include <set> | 10 #include <set> | 
| 11 #include <string> | 11 #include <string> | 
| 12 #include <vector> | 12 #include <vector> | 
| 13 | 13 | 
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" | 
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" | 
| 16 #include "base/logging.h" | 16 #include "base/logging.h" | 
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" | 
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" | 
| 19 #include "ui/accessibility/ax_enums.h" | 19 #include "ui/accessibility/ax_enums.h" | 
| 20 #include "ui/base/accelerators/accelerator.h" | 20 #include "ui/base/accelerators/accelerator.h" | 
| 21 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" | 
| 22 #include "ui/base/dragdrop/drop_target_event.h" | 22 #include "ui/base/dragdrop/drop_target_event.h" | 
| 23 #include "ui/base/dragdrop/os_exchange_data.h" | 23 #include "ui/base/dragdrop/os_exchange_data.h" | 
| 24 #include "ui/base/ui_base_types.h" | 24 #include "ui/base/ui_base_types.h" | 
| 25 #include "ui/compositor/layer_delegate.h" | 25 #include "ui/compositor/layer_delegate.h" | 
| 26 #include "ui/compositor/layer_owner.h" | 26 #include "ui/compositor/layer_owner.h" | 
| 27 #include "ui/events/event.h" | 27 #include "ui/events/event.h" | 
| 28 #include "ui/events/event_target.h" | 28 #include "ui/events/event_target.h" | 
| 29 #include "ui/events/event_targeter.h" | |
| 30 #include "ui/gfx/geometry/r_tree.h" | 29 #include "ui/gfx/geometry/r_tree.h" | 
| 31 #include "ui/gfx/insets.h" | 30 #include "ui/gfx/insets.h" | 
| 32 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" | 
| 33 #include "ui/gfx/rect.h" | 32 #include "ui/gfx/rect.h" | 
| 34 #include "ui/gfx/vector2d.h" | 33 #include "ui/gfx/vector2d.h" | 
| 35 #include "ui/views/cull_set.h" | 34 #include "ui/views/cull_set.h" | 
| 35 #include "ui/views/view_targeter.h" | |
| 36 #include "ui/views/views_export.h" | 36 #include "ui/views/views_export.h" | 
| 37 | 37 | 
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) | 
| 39 #include "base/win/scoped_comptr.h" | 39 #include "base/win/scoped_comptr.h" | 
| 40 #endif | 40 #endif | 
| 41 | 41 | 
| 42 using ui::OSExchangeData; | 42 using ui::OSExchangeData; | 
| 43 | 43 | 
| 44 namespace gfx { | 44 namespace gfx { | 
| 45 class Canvas; | 45 class Canvas; | 
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 // Returns the View's TextInputClient instance or NULL if the View doesn't | 712 // Returns the View's TextInputClient instance or NULL if the View doesn't | 
| 713 // support text input. | 713 // support text input. | 
| 714 virtual ui::TextInputClient* GetTextInputClient(); | 714 virtual ui::TextInputClient* GetTextInputClient(); | 
| 715 | 715 | 
| 716 // Convenience method to retrieve the InputMethod associated with the | 716 // Convenience method to retrieve the InputMethod associated with the | 
| 717 // Widget that contains this view. Returns NULL if this view is not part of a | 717 // Widget that contains this view. Returns NULL if this view is not part of a | 
| 718 // view hierarchy with a Widget. | 718 // view hierarchy with a Widget. | 
| 719 virtual InputMethod* GetInputMethod(); | 719 virtual InputMethod* GetInputMethod(); | 
| 720 virtual const InputMethod* GetInputMethod() const; | 720 virtual const InputMethod* GetInputMethod() const; | 
| 721 | 721 | 
| 722 // Sets a new event-targeter for the view, and returns the previous | 722 // Sets a new ViewTargeter for the view, and returns the previous | 
| 723 // event-targeter. | 723 // ViewTargeter. | 
| 724 scoped_ptr<ui::EventTargeter> SetEventTargeter( | 724 scoped_ptr<ViewTargeter> SetEventTargeter(scoped_ptr<ViewTargeter> targeter); | 
| 725 scoped_ptr<ui::EventTargeter> targeter); | |
| 726 | 725 | 
| 727 // Overridden from ui::EventTarget: | 726 // Overridden from ui::EventTarget: | 
| 728 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 727 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 
| 729 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 728 virtual ui::EventTarget* GetParentTarget() OVERRIDE; | 
| 730 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 729 virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; | 
| 731 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 730 virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; | 
| 732 virtual void ConvertEventToTarget(ui::EventTarget* target, | 731 virtual void ConvertEventToTarget(ui::EventTarget* target, | 
| 733 ui::LocatedEvent* event) OVERRIDE; | 732 ui::LocatedEvent* event) OVERRIDE; | 
| 734 | 733 | 
| 734 ViewTargeter* GetViewTargeter() const; | |
| 
sadrul
2014/06/27 21:23:38
Just ViewTargeter* targeter() { return targeter_.g
 
tdanderson
2014/06/27 22:01:13
Done.
 | |
| 735 | |
| 735 // Overridden from ui::EventHandler: | 736 // Overridden from ui::EventHandler: | 
| 736 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 737 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 
| 737 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 738 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 
| 738 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 739 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 
| 739 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; | 740 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; | 
| 740 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 741 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 
| 741 | 742 | 
| 742 // Accelerators -------------------------------------------------------------- | 743 // Accelerators -------------------------------------------------------------- | 
| 743 | 744 | 
| 744 // Sets a keyboard accelerator for that view. When the user presses the | 745 // Sets a keyboard accelerator for that view. When the user presses the | 
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 | 1598 | 
| 1598 // The menu controller. | 1599 // The menu controller. | 
| 1599 ContextMenuController* context_menu_controller_; | 1600 ContextMenuController* context_menu_controller_; | 
| 1600 | 1601 | 
| 1601 // Drag and drop ------------------------------------------------------------- | 1602 // Drag and drop ------------------------------------------------------------- | 
| 1602 | 1603 | 
| 1603 DragController* drag_controller_; | 1604 DragController* drag_controller_; | 
| 1604 | 1605 | 
| 1605 // Input -------------------------------------------------------------------- | 1606 // Input -------------------------------------------------------------------- | 
| 1606 | 1607 | 
| 1607 scoped_ptr<ui::EventTargeter> targeter_; | 1608 scoped_ptr<ViewTargeter> targeter_; | 
| 1608 | 1609 | 
| 1609 // Accessibility ------------------------------------------------------------- | 1610 // Accessibility ------------------------------------------------------------- | 
| 1610 | 1611 | 
| 1611 // Belongs to this view, but it's reference-counted on some platforms | 1612 // Belongs to this view, but it's reference-counted on some platforms | 
| 1612 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1613 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 
| 1613 NativeViewAccessibility* native_view_accessibility_; | 1614 NativeViewAccessibility* native_view_accessibility_; | 
| 1614 | 1615 | 
| 1615 DISALLOW_COPY_AND_ASSIGN(View); | 1616 DISALLOW_COPY_AND_ASSIGN(View); | 
| 1616 }; | 1617 }; | 
| 1617 | 1618 | 
| 1618 } // namespace views | 1619 } // namespace views | 
| 1619 | 1620 | 
| 1620 #endif // UI_VIEWS_VIEW_H_ | 1621 #endif // UI_VIEWS_VIEW_H_ | 
| OLD | NEW |