| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "services/window_manager/focus_controller.h" | 5 #include "services/window_manager/focus_controller.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "mojo/services/view_manager/public/cpp/view_property.h" | 8 #include "mojo/services/view_manager/public/cpp/view_property.h" |
| 9 #include "mojo/services/view_manager/public/cpp/view_tracker.h" | 9 #include "mojo/services/view_manager/public/cpp/view_tracker.h" |
| 10 #include "services/window_manager/focus_controller_observer.h" | 10 #include "services/window_manager/focus_controller_observer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (event->type() == ui::ET_MOUSE_PRESSED && !event->handled()) { | 126 if (event->type() == ui::ET_MOUSE_PRESSED && !event->handled()) { |
| 127 View* view = static_cast<ViewTarget*>(event->target())->view(); | 127 View* view = static_cast<ViewTarget*>(event->target())->view(); |
| 128 ViewFocusedFromInputEvent(view); | 128 ViewFocusedFromInputEvent(view); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void FocusController::OnScrollEvent(ui::ScrollEvent* event) { | 132 void FocusController::OnScrollEvent(ui::ScrollEvent* event) { |
| 133 } | 133 } |
| 134 | 134 |
| 135 void FocusController::OnTouchEvent(ui::TouchEvent* event) { | 135 void FocusController::OnTouchEvent(ui::TouchEvent* event) { |
| 136 if (event->type() == ui::ET_TOUCH_PRESSED && !event->handled()) { |
| 137 View* view = static_cast<ViewTarget*>(event->target())->view(); |
| 138 ViewFocusedFromInputEvent(view); |
| 139 } |
| 136 } | 140 } |
| 137 | 141 |
| 138 void FocusController::OnGestureEvent(ui::GestureEvent* event) { | 142 void FocusController::OnGestureEvent(ui::GestureEvent* event) { |
| 139 if (event->type() == ui::ET_GESTURE_BEGIN && | 143 if (event->type() == ui::ET_GESTURE_BEGIN && |
| 140 event->details().touch_points() == 1 && | 144 event->details().touch_points() == 1 && |
| 141 !event->handled()) { | 145 !event->handled()) { |
| 142 View* view = static_cast<ViewTarget*>(event->target())->view(); | 146 View* view = static_cast<ViewTarget*>(event->target())->view(); |
| 143 ViewFocusedFromInputEvent(view); | 147 ViewFocusedFromInputEvent(view); |
| 144 } | 148 } |
| 145 } | 149 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 314 } |
| 311 | 315 |
| 312 FocusController* GetFocusController(View* root_view) { | 316 FocusController* GetFocusController(View* root_view) { |
| 313 if (root_view) | 317 if (root_view) |
| 314 DCHECK_EQ(root_view->GetRoot(), root_view); | 318 DCHECK_EQ(root_view->GetRoot(), root_view); |
| 315 return root_view ? | 319 return root_view ? |
| 316 root_view->GetLocalProperty(kRootViewFocusController) : nullptr; | 320 root_view->GetLocalProperty(kRootViewFocusController) : nullptr; |
| 317 } | 321 } |
| 318 | 322 |
| 319 } // namespace window_manager | 323 } // namespace window_manager |
| OLD | NEW |