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

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

Issue 1033513003: Cleans up events to just the parts we're actually using (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 5 years, 9 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 | « examples/nesting_app/nesting_app.cc ('k') | examples/spinning_cube/gles2_client_impl.h » ('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 "base/strings/string_tokenizer.h" 5 #include "base/strings/string_tokenizer.h"
6 #include "examples/bitmap_uploader/bitmap_uploader.h" 6 #include "examples/bitmap_uploader/bitmap_uploader.h"
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/application/content_handler_factory.h" 8 #include "mojo/application/content_handler_factory.h"
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 void OnViewInputEvent(View* view, const EventPtr& event) override { 104 void OnViewInputEvent(View* view, const EventPtr& event) override {
105 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); 105 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end());
106 if (event->key_data && 106 if (event->key_data &&
107 (event->action != EVENT_TYPE_KEY_PRESSED || event->key_data->is_char)) { 107 (event->action != EVENT_TYPE_KEY_PRESSED || event->key_data->is_char)) {
108 return; 108 return;
109 } 109 }
110 if ((event->key_data && 110 if ((event->key_data &&
111 event->key_data->windows_key_code == KEYBOARD_CODE_DOWN) || 111 event->key_data->windows_key_code == KEYBOARD_CODE_DOWN) ||
112 (event->wheel_data && event->wheel_data->y_offset < 0)) { 112 (event->pointer_data && event->pointer_data->vertical_wheel < 0)) {
113 if (current_page_ < (page_count_ - 1)) { 113 if (current_page_ < (page_count_ - 1)) {
114 current_page_++; 114 current_page_++;
115 DrawBitmap(embedder_for_roots_[view]); 115 DrawBitmap(embedder_for_roots_[view]);
116 } 116 }
117 } else if ((event->key_data && 117 } else if ((event->key_data &&
118 event->key_data->windows_key_code == KEYBOARD_CODE_UP) || 118 event->key_data->windows_key_code == KEYBOARD_CODE_UP) ||
119 (event->wheel_data && event->wheel_data->y_offset > 0)) { 119 (event->pointer_data &&
120 event->pointer_data->vertical_wheel > 0)) {
120 if (current_page_ > 0) { 121 if (current_page_ > 0) {
121 current_page_--; 122 current_page_--;
122 DrawBitmap(embedder_for_roots_[view]); 123 DrawBitmap(embedder_for_roots_[view]);
123 } 124 }
124 } 125 }
125 } 126 }
126 127
127 void OnViewDestroyed(View* view) override { 128 void OnViewDestroyed(View* view) override {
128 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end()); 129 DCHECK(embedder_for_roots_.find(view) != embedder_for_roots_.end());
129 const auto& it = embedder_for_roots_.find(view); 130 const auto& it = embedder_for_roots_.find(view);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 DISALLOW_COPY_AND_ASSIGN(PDFViewer); 240 DISALLOW_COPY_AND_ASSIGN(PDFViewer);
240 }; 241 };
241 242
242 } // namespace examples 243 } // namespace examples
243 } // namespace mojo 244 } // namespace mojo
244 245
245 MojoResult MojoMain(MojoHandle shell_handle) { 246 MojoResult MojoMain(MojoHandle shell_handle) {
246 mojo::ApplicationRunnerChromium runner(new mojo::examples::PDFViewer()); 247 mojo::ApplicationRunnerChromium runner(new mojo::examples::PDFViewer());
247 return runner.Run(shell_handle); 248 return runner.Run(shell_handle);
248 } 249 }
OLDNEW
« no previous file with comments | « examples/nesting_app/nesting_app.cc ('k') | examples/spinning_cube/gles2_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698