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

Side by Side Diff: services/window_manager/focus_controller.cc

Issue 869543002: Focus Views on touch events. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « services/native_viewport/platform_viewport_android.cc ('k') | sky/viewer/document_view.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 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
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
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
OLDNEW
« no previous file with comments | « services/native_viewport/platform_viewport_android.cc ('k') | sky/viewer/document_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698