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

Side by Side Diff: services/keyboard_native/view_observer_delegate.cc

Issue 1375313006: For c++, Generate enum classes instead of enum from mojom. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <math.h> 5 #include <math.h>
6 6
7 #include "services/keyboard_native/view_observer_delegate.h" 7 #include "services/keyboard_native/view_observer_delegate.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 auto it2 = active_pointer_state_.find(pointer_id); 134 auto it2 = active_pointer_state_.find(pointer_id);
135 if (it2 != active_pointer_state_.end()) { 135 if (it2 != active_pointer_state_.end()) {
136 if (it2->second->last_point_valid) { 136 if (it2->second->last_point_valid) {
137 animations_.push_back(make_scoped_ptr( 137 animations_.push_back(make_scoped_ptr(
138 new MotionDecayAnimation(current_ticks, kAnimationDurationMs, 138 new MotionDecayAnimation(current_ticks, kAnimationDurationMs,
139 it2->second->last_point, touch_point))); 139 it2->second->last_point, touch_point)));
140 it2->second->last_point = touch_point; 140 it2->second->last_point = touch_point;
141 } else { 141 } else {
142 it2->second->last_point = touch_point; 142 it2->second->last_point = touch_point;
143 } 143 }
144 it2->second->last_point_valid = action != mojo::EVENT_TYPE_POINTER_UP; 144 it2->second->last_point_valid = action != mojo::EventType::POINTER_UP;
145 } 145 }
146 146
147 if (action == mojo::EVENT_TYPE_POINTER_UP || 147 if (action == mojo::EventType::POINTER_UP ||
148 action == mojo::EVENT_TYPE_POINTER_DOWN) { 148 action == mojo::EventType::POINTER_DOWN) {
149 animations_.push_back(make_scoped_ptr(new MaterialSplashAnimation( 149 animations_.push_back(make_scoped_ptr(new MaterialSplashAnimation(
150 current_ticks, kAnimationDurationMs, touch_point))); 150 current_ticks, kAnimationDurationMs, touch_point)));
151 } 151 }
152 } 152 }
153 153
154 void ViewObserverDelegate::DrawKeysToCanvas(const gfx::RectF& key_area, 154 void ViewObserverDelegate::DrawKeysToCanvas(const gfx::RectF& key_area,
155 SkCanvas* canvas) { 155 SkCanvas* canvas) {
156 key_layout_.SetKeyArea(key_area); 156 key_layout_.SetKeyArea(key_area);
157 key_layout_.Draw(canvas); 157 key_layout_.Draw(canvas);
158 } 158 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 new ClipAnimation(current_ticks, kAnimationDurationMs, center, radius)); 329 new ClipAnimation(current_ticks, kAnimationDurationMs, center, radius));
330 330
331 IssueDraw(); 331 IssueDraw();
332 } 332 }
333 333
334 void ViewObserverDelegate::OnViewInputEvent(mojo::View* view, 334 void ViewObserverDelegate::OnViewInputEvent(mojo::View* view,
335 const mojo::EventPtr& event) { 335 const mojo::EventPtr& event) {
336 if (event->pointer_data) { 336 if (event->pointer_data) {
337 gfx::PointF point(event->pointer_data->x, event->pointer_data->y); 337 gfx::PointF point(event->pointer_data->x, event->pointer_data->y);
338 338
339 if (event->action == mojo::EVENT_TYPE_POINTER_UP) { 339 if (event->action == mojo::EventType::POINTER_UP) {
340 key_layout_.OnTouchUp(point); 340 key_layout_.OnTouchUp(point);
341 } 341 }
342 342
343 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || 343 if (event->action == mojo::EventType::POINTER_DOWN ||
344 event->action == mojo::EVENT_TYPE_POINTER_UP) { 344 event->action == mojo::EventType::POINTER_UP) {
345 auto it = 345 auto it =
346 std::find(active_pointer_ids_.begin(), active_pointer_ids_.end(), 346 std::find(active_pointer_ids_.begin(), active_pointer_ids_.end(),
347 event->pointer_data->pointer_id); 347 event->pointer_data->pointer_id);
348 if (it != active_pointer_ids_.end()) { 348 if (it != active_pointer_ids_.end()) {
349 active_pointer_ids_.erase(it); 349 active_pointer_ids_.erase(it);
350 } 350 }
351 351
352 auto it2 = active_pointer_state_.find(event->pointer_data->pointer_id); 352 auto it2 = active_pointer_state_.find(event->pointer_data->pointer_id);
353 if (it2 != active_pointer_state_.end()) { 353 if (it2 != active_pointer_state_.end()) {
354 active_pointer_state_.erase(it2); 354 active_pointer_state_.erase(it2);
355 } 355 }
356 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN) { 356 if (event->action == mojo::EventType::POINTER_DOWN) {
357 active_pointer_ids_.push_back(event->pointer_data->pointer_id); 357 active_pointer_ids_.push_back(event->pointer_data->pointer_id);
358 PointerState* pointer_state = new PointerState(); 358 PointerState* pointer_state = new PointerState();
359 pointer_state->last_key = nullptr; 359 pointer_state->last_key = nullptr;
360 pointer_state->last_point = gfx::PointF(); 360 pointer_state->last_point = gfx::PointF();
361 pointer_state->last_point_valid = false; 361 pointer_state->last_point_valid = false;
362 active_pointer_state_[event->pointer_data->pointer_id].reset( 362 active_pointer_state_[event->pointer_data->pointer_id].reset(
363 pointer_state); 363 pointer_state);
364 } 364 }
365 } 365 }
366 366
(...skipping 10 matching lines...) Expand all
377 377
378 void ViewObserverDelegate::OnViewDestroyed(mojo::View* view) { 378 void ViewObserverDelegate::OnViewDestroyed(mojo::View* view) {
379 if (view_ == view) { 379 if (view_ == view) {
380 view_->RemoveObserver(this); 380 view_->RemoveObserver(this);
381 view_ = nullptr; 381 view_ = nullptr;
382 gl_context_->Destroy(); 382 gl_context_->Destroy();
383 } 383 }
384 } 384 }
385 385
386 } // namespace keyboard 386 } // namespace keyboard
OLDNEW
« no previous file with comments | « services/http_server/http_server_factory_impl.cc ('k') | services/native_support/process_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698