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

Side by Side Diff: services/native_viewport/platform_viewport_android.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 | « no previous file | services/window_manager/focus_controller.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/native_viewport/platform_viewport_android.h" 5 #include "services/native_viewport/platform_viewport_android.h"
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 jint action_and_index, 103 jint action_and_index,
104 jfloat x, jfloat y, 104 jfloat x, jfloat y,
105 jlong time_ms) { 105 jlong time_ms) {
106 gfx::Point location(static_cast<int>(x), static_cast<int>(y)); 106 gfx::Point location(static_cast<int>(x), static_cast<int>(y));
107 jint action = action_and_index & AMOTION_EVENT_ACTION_MASK; 107 jint action = action_and_index & AMOTION_EVENT_ACTION_MASK;
108 ui::TouchEvent event(MotionEventActionToEventType(action), location, 108 ui::TouchEvent event(MotionEventActionToEventType(action), location,
109 id_generator_.GetGeneratedID(pointer_id), 109 id_generator_.GetGeneratedID(pointer_id),
110 base::TimeDelta::FromMilliseconds(time_ms)); 110 base::TimeDelta::FromMilliseconds(time_ms));
111 // TODO(beng): handle multiple touch-points. 111 // TODO(beng): handle multiple touch-points.
112 delegate_->OnEvent(&event); 112 delegate_->OnEvent(&event);
113 if (action == ui::ET_TOUCH_RELEASED || action == ui::ET_TOUCH_CANCELLED) 113 if (event.type() == ui::ET_TOUCH_RELEASED ||
114 event.type() == ui::ET_TOUCH_CANCELLED)
114 id_generator_.ReleaseNumber(pointer_id); 115 id_generator_.ReleaseNumber(pointer_id);
115 116
116 return true; 117 return true;
117 } 118 }
118 119
119 bool PlatformViewportAndroid::KeyEvent(JNIEnv* env, 120 bool PlatformViewportAndroid::KeyEvent(JNIEnv* env,
120 jobject obj, 121 jobject obj,
121 bool pressed, 122 bool pressed,
122 jint key_code, 123 jint key_code,
123 jint unicode_character) { 124 jint unicode_character) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
188 // PlatformViewport, public: 189 // PlatformViewport, public:
189 190
190 // static 191 // static
191 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) { 192 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) {
192 return scoped_ptr<PlatformViewport>( 193 return scoped_ptr<PlatformViewport>(
193 new PlatformViewportAndroid(delegate)).Pass(); 194 new PlatformViewportAndroid(delegate)).Pass();
194 } 195 }
195 196
196 } // namespace native_viewport 197 } // namespace native_viewport
OLDNEW
« no previous file with comments | « no previous file | services/window_manager/focus_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698