| 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_WIDGET_WIDGET_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_H_ |
| 6 #define UI_VIEWS_WIDGET_WIDGET_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 708 |
| 709 // Reorders the widget's child NativeViews which are associated to the view | 709 // Reorders the widget's child NativeViews which are associated to the view |
| 710 // tree (eg via a NativeViewHost) to match the z-order of the views in the | 710 // tree (eg via a NativeViewHost) to match the z-order of the views in the |
| 711 // view tree. The z-order of views with layers relative to views with | 711 // view tree. The z-order of views with layers relative to views with |
| 712 // associated NativeViews is used to reorder the NativeView layers. This | 712 // associated NativeViews is used to reorder the NativeView layers. This |
| 713 // method assumes that the widget's child layers which are owned by a view are | 713 // method assumes that the widget's child layers which are owned by a view are |
| 714 // already in the correct z-order relative to each other and does no | 714 // already in the correct z-order relative to each other and does no |
| 715 // reordering if there are no views with an associated NativeView. | 715 // reordering if there are no views with an associated NativeView. |
| 716 void ReorderNativeViews(); | 716 void ReorderNativeViews(); |
| 717 | 717 |
| 718 // Schedules an update to the root layers. The actual processing occurs when | 718 // Called by a View when the status of it's layer or one of the views |
| 719 // GetRootLayers() is invoked. | 719 // descendants layer status changes. |
| 720 void UpdateRootLayers(); | 720 void LayerTreeChanged(); |
| 721 | 721 |
| 722 const NativeWidget* native_widget() const; | 722 const NativeWidget* native_widget() const; |
| 723 NativeWidget* native_widget(); | 723 NativeWidget* native_widget(); |
| 724 | 724 |
| 725 internal::NativeWidgetPrivate* native_widget_private() { | 725 internal::NativeWidgetPrivate* native_widget_private() { |
| 726 return native_widget_; | 726 return native_widget_; |
| 727 } | 727 } |
| 728 const internal::NativeWidgetPrivate* native_widget_private() const { | 728 const internal::NativeWidgetPrivate* native_widget_private() const { |
| 729 return native_widget_; | 729 return native_widget_; |
| 730 } | 730 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 void OnNativeWidgetEndUserBoundsChange() override; | 809 void OnNativeWidgetEndUserBoundsChange() override; |
| 810 bool HasFocusManager() const override; | 810 bool HasFocusManager() const override; |
| 811 void OnNativeWidgetPaint(const ui::PaintContext& context) override; | 811 void OnNativeWidgetPaint(const ui::PaintContext& context) override; |
| 812 int GetNonClientComponent(const gfx::Point& point) override; | 812 int GetNonClientComponent(const gfx::Point& point) override; |
| 813 void OnKeyEvent(ui::KeyEvent* event) override; | 813 void OnKeyEvent(ui::KeyEvent* event) override; |
| 814 void OnMouseEvent(ui::MouseEvent* event) override; | 814 void OnMouseEvent(ui::MouseEvent* event) override; |
| 815 void OnMouseCaptureLost() override; | 815 void OnMouseCaptureLost() override; |
| 816 void OnScrollEvent(ui::ScrollEvent* event) override; | 816 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 817 void OnGestureEvent(ui::GestureEvent* event) override; | 817 void OnGestureEvent(ui::GestureEvent* event) override; |
| 818 bool ExecuteCommand(int command_id) override; | 818 bool ExecuteCommand(int command_id) override; |
| 819 const std::vector<ui::Layer*>& GetRootLayers() override; | |
| 820 bool HasHitTestMask() const override; | 819 bool HasHitTestMask() const override; |
| 821 void GetHitTestMask(gfx::Path* mask) const override; | 820 void GetHitTestMask(gfx::Path* mask) const override; |
| 822 Widget* AsWidget() override; | 821 Widget* AsWidget() override; |
| 823 const Widget* AsWidget() const override; | 822 const Widget* AsWidget() const override; |
| 824 bool SetInitialFocus(ui::WindowShowState show_state) override; | 823 bool SetInitialFocus(ui::WindowShowState show_state) override; |
| 824 bool ShouldDescendIntoChildForEventHandling( |
| 825 ui::Layer* root_layer, |
| 826 gfx::NativeView child, |
| 827 ui::Layer* child_layer, |
| 828 const gfx::Point& location) override; |
| 825 | 829 |
| 826 // Overridden from ui::EventSource: | 830 // Overridden from ui::EventSource: |
| 827 ui::EventProcessor* GetEventProcessor() override; | 831 ui::EventProcessor* GetEventProcessor() override; |
| 828 | 832 |
| 829 // Overridden from FocusTraversable: | 833 // Overridden from FocusTraversable: |
| 830 FocusSearch* GetFocusSearch() override; | 834 FocusSearch* GetFocusSearch() override; |
| 831 FocusTraversable* GetFocusTraversableParent() override; | 835 FocusTraversable* GetFocusTraversableParent() override; |
| 832 View* GetFocusTraversableParentView() override; | 836 View* GetFocusTraversableParentView() override; |
| 833 | 837 |
| 834 // Overridden from ui::NativeThemeObserver: | 838 // Overridden from ui::NativeThemeObserver: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 848 // Notification that a drag will start. Default implementation does nothing. | 852 // Notification that a drag will start. Default implementation does nothing. |
| 849 virtual void OnDragWillStart(); | 853 virtual void OnDragWillStart(); |
| 850 | 854 |
| 851 // Notification that the drag performed by RunShellDrag() has completed. | 855 // Notification that the drag performed by RunShellDrag() has completed. |
| 852 virtual void OnDragComplete(); | 856 virtual void OnDragComplete(); |
| 853 | 857 |
| 854 private: | 858 private: |
| 855 friend class ComboboxTest; | 859 friend class ComboboxTest; |
| 856 friend class CustomButtonTest; | 860 friend class CustomButtonTest; |
| 857 friend class TextfieldTest; | 861 friend class TextfieldTest; |
| 862 friend class ViewAuraTest; |
| 858 | 863 |
| 859 // Persists the window's restored position and "show" state using the | 864 // Persists the window's restored position and "show" state using the |
| 860 // window delegate. | 865 // window delegate. |
| 861 void SaveWindowPlacement(); | 866 void SaveWindowPlacement(); |
| 862 | 867 |
| 863 // Invokes SaveWindowPlacement() if the native widget has been initialized. | 868 // Invokes SaveWindowPlacement() if the native widget has been initialized. |
| 864 // This is called at times when the native widget may not have been | 869 // This is called at times when the native widget may not have been |
| 865 // initialized. | 870 // initialized. |
| 866 void SaveWindowPlacementIfInitialized(); | 871 void SaveWindowPlacementIfInitialized(); |
| 867 | 872 |
| 868 // Sizes and positions the window just after it is created. | 873 // Sizes and positions the window just after it is created. |
| 869 void SetInitialBounds(const gfx::Rect& bounds); | 874 void SetInitialBounds(const gfx::Rect& bounds); |
| 870 | 875 |
| 871 // Sizes and positions the frameless window just after it is created. | 876 // Sizes and positions the frameless window just after it is created. |
| 872 void SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds); | 877 void SetInitialBoundsForFramelessWindow(const gfx::Rect& bounds); |
| 873 | 878 |
| 874 // Returns the bounds and "show" state from the delegate. Returns true if | 879 // Returns the bounds and "show" state from the delegate. Returns true if |
| 875 // the delegate wants to use a specified bounds. | 880 // the delegate wants to use a specified bounds. |
| 876 bool GetSavedWindowPlacement(gfx::Rect* bounds, | 881 bool GetSavedWindowPlacement(gfx::Rect* bounds, |
| 877 ui::WindowShowState* show_state); | 882 ui::WindowShowState* show_state); |
| 878 | 883 |
| 884 // Returns the Views whose layers are parented directly to the Widget's |
| 885 // layer. |
| 886 const View::Views& GetViewsWithLayers(); |
| 887 |
| 879 internal::NativeWidgetPrivate* native_widget_; | 888 internal::NativeWidgetPrivate* native_widget_; |
| 880 | 889 |
| 881 base::ObserverList<WidgetObserver> observers_; | 890 base::ObserverList<WidgetObserver> observers_; |
| 882 | 891 |
| 883 base::ObserverList<WidgetRemovalsObserver> removals_observers_; | 892 base::ObserverList<WidgetRemovalsObserver> removals_observers_; |
| 884 | 893 |
| 885 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied | 894 // Non-owned pointer to the Widget's delegate. If a NULL delegate is supplied |
| 886 // to Init() a default WidgetDelegate is created. | 895 // to Init() a default WidgetDelegate is created. |
| 887 WidgetDelegate* widget_delegate_; | 896 WidgetDelegate* widget_delegate_; |
| 888 | 897 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 // The following are used to detect duplicate mouse move events and not | 969 // The following are used to detect duplicate mouse move events and not |
| 961 // deliver them. Displaying a window may result in the system generating | 970 // deliver them. Displaying a window may result in the system generating |
| 962 // duplicate move events even though the mouse hasn't moved. | 971 // duplicate move events even though the mouse hasn't moved. |
| 963 bool last_mouse_event_was_move_; | 972 bool last_mouse_event_was_move_; |
| 964 gfx::Point last_mouse_event_position_; | 973 gfx::Point last_mouse_event_position_; |
| 965 | 974 |
| 966 // True if event capture should be released on a mouse up event. Default is | 975 // True if event capture should be released on a mouse up event. Default is |
| 967 // true. | 976 // true. |
| 968 bool auto_release_capture_; | 977 bool auto_release_capture_; |
| 969 | 978 |
| 970 // See description in GetRootLayers(). | 979 // See description in GetViewsWithLayers(). |
| 971 std::vector<ui::Layer*> root_layers_; | 980 View::Views views_with_layers_; |
| 972 | 981 |
| 973 // Is |root_layers_| out of date? | 982 // Does |views_with_layers_| need updating? |
| 974 bool root_layers_dirty_; | 983 bool views_with_layers_dirty_; |
| 975 | 984 |
| 976 // True when window movement via mouse interaction with the frame should be | 985 // True when window movement via mouse interaction with the frame should be |
| 977 // disabled. | 986 // disabled. |
| 978 bool movement_disabled_; | 987 bool movement_disabled_; |
| 979 | 988 |
| 980 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; | 989 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; |
| 981 | 990 |
| 982 DISALLOW_COPY_AND_ASSIGN(Widget); | 991 DISALLOW_COPY_AND_ASSIGN(Widget); |
| 983 }; | 992 }; |
| 984 | 993 |
| 985 } // namespace views | 994 } // namespace views |
| 986 | 995 |
| 987 #endif // UI_VIEWS_WIDGET_WIDGET_H_ | 996 #endif // UI_VIEWS_WIDGET_WIDGET_H_ |
| OLD | NEW |