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

Side by Side Diff: components/pdf_viewer/pdf_viewer.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "components/mus/public/cpp/types.h" 9 #include "components/mus/public/cpp/types.h"
10 #include "components/mus/public/cpp/view.h" 10 #include "components/mus/public/cpp/view.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void OnViewInputEvent(mojo::View* view, 376 void OnViewInputEvent(mojo::View* view,
377 const mojo::EventPtr& event) override { 377 const mojo::EventPtr& event) override {
378 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); 378 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end());
379 if (event->key_data && 379 if (event->key_data &&
380 (event->action != mojo::EVENT_TYPE_KEY_PRESSED || 380 (event->action != mojo::EVENT_TYPE_KEY_PRESSED ||
381 event->key_data->is_char)) { 381 event->key_data->is_char)) {
382 return; 382 return;
383 } 383 }
384 384
385 // TODO(rjkroege): Make panning and scrolling more performant and
386 // responsive to gesture events.
387 if ((event->key_data && 385 if ((event->key_data &&
388 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_DOWN) || 386 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_DOWN) ||
389 (event->wheel_data && event->wheel_data && 387 (event->pointer_data && event->pointer_data->vertical_wheel < 0)) {
390 event->wheel_data->delta_y < 0)) {
391 if (current_page_ < (page_count_ - 1)) { 388 if (current_page_ < (page_count_ - 1)) {
392 current_page_++; 389 current_page_++;
393 DrawBitmap(embedder_for_roots_[view]); 390 DrawBitmap(embedder_for_roots_[view]);
394 } 391 }
395 } else if ((event->key_data && 392 } else if ((event->key_data &&
396 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_UP) || 393 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_UP) ||
397 (event->pointer_data && event->wheel_data && 394 (event->pointer_data &&
398 event->wheel_data->delta_y > 0)) { 395 event->pointer_data->vertical_wheel > 0)) {
399 if (current_page_ > 0) { 396 if (current_page_ > 0) {
400 current_page_--; 397 current_page_--;
401 DrawBitmap(embedder_for_roots_[view]); 398 DrawBitmap(embedder_for_roots_[view]);
402 } 399 }
403 } 400 }
404 } 401 }
405 402
406 void OnViewDestroyed(mojo::View* view) override { 403 void OnViewDestroyed(mojo::View* view) override {
407 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); 404 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end());
408 const auto& it = embedder_for_roots_.find(view); 405 const auto& it = embedder_for_roots_.find(view);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 DISALLOW_COPY_AND_ASSIGN(PDFViewer); 515 DISALLOW_COPY_AND_ASSIGN(PDFViewer);
519 }; 516 };
520 517
521 } // namespace 518 } // namespace
522 } // namespace pdf_viewer 519 } // namespace pdf_viewer
523 520
524 MojoResult MojoMain(MojoHandle application_request) { 521 MojoResult MojoMain(MojoHandle application_request) {
525 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); 522 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer());
526 return runner.Run(application_request); 523 return runner.Run(application_request);
527 } 524 }
OLDNEW
« no previous file with comments | « components/mus/view_tree_unittest.cc ('k') | mojo/converters/input_events/input_events_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698