| 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_ROOT_VIEW_H_ | 5 #ifndef UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "ui/events/event_processor.h" | 11 #include "ui/events/event_processor.h" |
| 12 #include "ui/views/focus/focus_manager.h" | 12 #include "ui/views/focus/focus_manager.h" |
| 13 #include "ui/views/focus/focus_search.h" | 13 #include "ui/views/focus/focus_search.h" |
| 14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 15 #include "ui/views/view_targeter_delegate.h" | 15 #include "ui/views/view_targeter_delegate.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 namespace test { | 19 namespace test { |
| 20 class ViewTargeterTest; |
| 20 class WidgetTest; | 21 class WidgetTest; |
| 21 } | 22 } |
| 22 | 23 |
| 24 class RootViewTargeter; |
| 23 class Widget; | 25 class Widget; |
| 24 | 26 |
| 25 // This is a views-internal API and should not be used externally. | 27 // This is a views-internal API and should not be used externally. |
| 26 // Widget exposes this object as a View*. | 28 // Widget exposes this object as a View*. |
| 27 namespace internal { | 29 namespace internal { |
| 28 class PreEventDispatchHandler; | 30 class PreEventDispatchHandler; |
| 29 | 31 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 31 // RootView class | 33 // RootView class |
| 32 // | 34 // |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Overridden from View: | 117 // Overridden from View: |
| 116 virtual void ViewHierarchyChanged( | 118 virtual void ViewHierarchyChanged( |
| 117 const ViewHierarchyChangedDetails& details) OVERRIDE; | 119 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 118 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; | 120 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; |
| 119 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 121 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 120 virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( | 122 virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( |
| 121 ui::Layer** layer_parent) OVERRIDE; | 123 ui::Layer** layer_parent) OVERRIDE; |
| 122 virtual View::DragInfo* GetDragInfo() OVERRIDE; | 124 virtual View::DragInfo* GetDragInfo() OVERRIDE; |
| 123 | 125 |
| 124 private: | 126 private: |
| 127 friend class ::views::RootViewTargeter; |
| 125 friend class ::views::View; | 128 friend class ::views::View; |
| 126 friend class ::views::Widget; | 129 friend class ::views::Widget; |
| 130 friend class ::views::test::ViewTargeterTest; |
| 127 friend class ::views::test::WidgetTest; | 131 friend class ::views::test::WidgetTest; |
| 128 | 132 |
| 129 // Input --------------------------------------------------------------------- | 133 // Input --------------------------------------------------------------------- |
| 130 | 134 |
| 131 // TODO(tdanderson): Remove RootView::DispatchGestureEvent() once | 135 // TODO(tdanderson): Remove RootView::DispatchGestureEvent() once |
| 132 // its targeting and dispatch logic has been moved | 136 // its targeting and dispatch logic has been moved |
| 133 // elsewhere. See crbug.com/348083. | 137 // elsewhere. See crbug.com/348083. |
| 134 void DispatchGestureEvent(ui::GestureEvent* event); | 138 void DispatchGestureEvent(ui::GestureEvent* event); |
| 135 | 139 |
| 136 // Update the cursor given a mouse event. This is called by non mouse_move | 140 // Update the cursor given a mouse event. This is called by non mouse_move |
| (...skipping 24 matching lines...) Expand all Loading... |
| 161 ui::EventTarget* target, const ui::Event& event) OVERRIDE; | 165 ui::EventTarget* target, const ui::Event& event) OVERRIDE; |
| 162 | 166 |
| 163 ////////////////////////////////////////////////////////////////////////////// | 167 ////////////////////////////////////////////////////////////////////////////// |
| 164 // Tree operations ----------------------------------------------------------- | 168 // Tree operations ----------------------------------------------------------- |
| 165 | 169 |
| 166 // The host Widget | 170 // The host Widget |
| 167 Widget* widget_; | 171 Widget* widget_; |
| 168 | 172 |
| 169 // Input --------------------------------------------------------------------- | 173 // Input --------------------------------------------------------------------- |
| 170 | 174 |
| 175 // TODO(tdanderson): Consider moving the input-related members into |
| 176 // ViewTargeter / RootViewTargeter. |
| 177 |
| 171 // The view currently handing down - drag - up | 178 // The view currently handing down - drag - up |
| 172 View* mouse_pressed_handler_; | 179 View* mouse_pressed_handler_; |
| 173 | 180 |
| 174 // The view currently handling enter / exit | 181 // The view currently handling enter / exit |
| 175 View* mouse_move_handler_; | 182 View* mouse_move_handler_; |
| 176 | 183 |
| 177 // The last view to handle a mouse click, so that we can determine if | 184 // The last view to handle a mouse click, so that we can determine if |
| 178 // a double-click lands on the same view as its single-click part. | 185 // a double-click lands on the same view as its single-click part. |
| 179 View* last_click_handler_; | 186 View* last_click_handler_; |
| 180 | 187 |
| 181 // true if mouse_pressed_handler_ has been explicitly set | 188 // true if mouse_pressed_handler_ has been explicitly set |
| 182 bool explicit_mouse_handler_; | 189 bool explicit_mouse_handler_; |
| 183 | 190 |
| 184 // Last position/flag of a mouse press/drag. Used if capture stops and we need | 191 // Last position/flag of a mouse press/drag. Used if capture stops and we need |
| 185 // to synthesize a release. | 192 // to synthesize a release. |
| 186 int last_mouse_event_flags_; | 193 int last_mouse_event_flags_; |
| 187 int last_mouse_event_x_; | 194 int last_mouse_event_x_; |
| 188 int last_mouse_event_y_; | 195 int last_mouse_event_y_; |
| 189 | 196 |
| 190 // The view currently handling gesture events. When set, this handler receives | 197 // The View currently handling gesture events. |
| 191 // all gesture events. | |
| 192 View* gesture_handler_; | 198 View* gesture_handler_; |
| 193 | 199 |
| 200 // If true, then gesture events received from Widget are permitted to be |
| 201 // re-targeted and re-dispatched while they remain unhandled. |
| 202 bool allow_gesture_event_retargeting_; |
| 203 |
| 194 scoped_ptr<internal::PreEventDispatchHandler> pre_dispatch_handler_; | 204 scoped_ptr<internal::PreEventDispatchHandler> pre_dispatch_handler_; |
| 195 scoped_ptr<internal::PostEventDispatchHandler> post_dispatch_handler_; | 205 scoped_ptr<internal::PostEventDispatchHandler> post_dispatch_handler_; |
| 196 | 206 |
| 197 // Focus --------------------------------------------------------------------- | 207 // Focus --------------------------------------------------------------------- |
| 198 | 208 |
| 199 // The focus search algorithm. | 209 // The focus search algorithm. |
| 200 FocusSearch focus_search_; | 210 FocusSearch focus_search_; |
| 201 | 211 |
| 202 // Whether this root view belongs to the current active window. | 212 // Whether this root view belongs to the current active window. |
| 203 // bool activated_; | 213 // bool activated_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 217 // Tracks drag state for a view. | 227 // Tracks drag state for a view. |
| 218 View::DragInfo drag_info_; | 228 View::DragInfo drag_info_; |
| 219 | 229 |
| 220 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); | 230 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); |
| 221 }; | 231 }; |
| 222 | 232 |
| 223 } // namespace internal | 233 } // namespace internal |
| 224 } // namespace views | 234 } // namespace views |
| 225 | 235 |
| 226 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 236 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| OLD | NEW |