OLD | NEW |
---|---|
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 if (event->key_data && | 378 if (event->key_data && |
379 (event->action != mojo::EVENT_TYPE_KEY_PRESSED || | 379 (event->action != mojo::EVENT_TYPE_KEY_PRESSED || |
380 event->key_data->is_char)) { | 380 event->key_data->is_char)) { |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 // TODO(rjkroege): Make panning and scrolling more performant and | 384 // TODO(rjkroege): Make panning and scrolling more performant and |
385 // responsive to gesture events. | 385 // responsive to gesture events. |
386 if ((event->key_data && | 386 if ((event->key_data && |
387 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_DOWN) || | 387 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_DOWN) || |
388 (event->wheel_data && event->wheel_data && | 388 (event->wheel_data && event->wheel_data->delta_y < 0)) { |
rjkroege
2015/09/22 22:52:41
my oops.
| |
389 event->wheel_data->delta_y < 0)) { | |
390 if (current_page_ < (page_count_ - 1)) { | 389 if (current_page_ < (page_count_ - 1)) { |
391 current_page_++; | 390 current_page_++; |
392 DrawBitmap(embedder_for_roots_[view]); | 391 DrawBitmap(embedder_for_roots_[view]); |
393 } | 392 } |
394 } else if ((event->key_data && | 393 } else if ((event->key_data && |
395 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_UP) || | 394 event->key_data->windows_key_code == mojo::KEYBOARD_CODE_UP) || |
396 (event->pointer_data && event->wheel_data && | 395 (event->wheel_data && event->wheel_data->delta_y > 0)) { |
397 event->wheel_data->delta_y > 0)) { | |
398 if (current_page_ > 0) { | 396 if (current_page_ > 0) { |
399 current_page_--; | 397 current_page_--; |
400 DrawBitmap(embedder_for_roots_[view]); | 398 DrawBitmap(embedder_for_roots_[view]); |
401 } | 399 } |
402 } | 400 } |
403 } | 401 } |
404 | 402 |
405 void OnViewDestroyed(mus::View* view) override { | 403 void OnViewDestroyed(mus::View* view) override { |
406 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); | 404 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); |
407 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 Loading... | |
517 DISALLOW_COPY_AND_ASSIGN(PDFViewer); | 515 DISALLOW_COPY_AND_ASSIGN(PDFViewer); |
518 }; | 516 }; |
519 | 517 |
520 } // namespace | 518 } // namespace |
521 } // namespace pdf_viewer | 519 } // namespace pdf_viewer |
522 | 520 |
523 MojoResult MojoMain(MojoHandle application_request) { | 521 MojoResult MojoMain(MojoHandle application_request) { |
524 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); | 522 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); |
525 return runner.Run(application_request); | 523 return runner.Run(application_request); |
526 } | 524 } |
OLD | NEW |