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

Side by Side Diff: mojo/examples/aura_demo/window_tree_host_mojo.cc

Issue 218763002: Change AckEvent into request / response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix early return Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "mojo/examples/aura_demo/window_tree_host_mojo.h" 5 #include "mojo/examples/aura_demo/window_tree_host_mojo.h"
6 6
7 #include "mojo/examples/aura_demo/demo_context_factory.h" 7 #include "mojo/examples/aura_demo/demo_context_factory.h"
8 #include "mojo/public/bindings/allocation_scope.h" 8 #include "mojo/public/bindings/allocation_scope.h"
9 #include "mojo/public/c/gles2/gles2.h" 9 #include "mojo/public/c/gles2/gles2.h"
10 #include "mojo/services/native_viewport/geometry_conversions.h" 10 #include "mojo/services/native_viewport/geometry_conversions.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(), 159 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(),
160 bounds.size().width(), bounds.size().height()); 160 bounds.size().width(), bounds.size().height());
161 window()->SetBounds(gfx::Rect(bounds_.size())); 161 window()->SetBounds(gfx::Rect(bounds_.size()));
162 OnHostResized(bounds_.size()); 162 OnHostResized(bounds_.size());
163 } 163 }
164 164
165 void WindowTreeHostMojo::OnDestroyed() { 165 void WindowTreeHostMojo::OnDestroyed() {
166 base::MessageLoop::current()->Quit(); 166 base::MessageLoop::current()->Quit();
167 } 167 }
168 168
169 void WindowTreeHostMojo::OnEvent(const Event& event) { 169 void WindowTreeHostMojo::OnEvent(const Event& event,
170 if (!event.location().is_null()) 170 const mojo::Callback<void()>& callback) {
171 native_viewport_->AckEvent(event);
172
173 switch (event.action()) { 171 switch (event.action()) {
174 case ui::ET_MOUSE_PRESSED: 172 case ui::ET_MOUSE_PRESSED:
175 case ui::ET_MOUSE_DRAGGED: 173 case ui::ET_MOUSE_DRAGGED:
176 case ui::ET_MOUSE_RELEASED: 174 case ui::ET_MOUSE_RELEASED:
177 case ui::ET_MOUSE_MOVED: 175 case ui::ET_MOUSE_MOVED:
178 case ui::ET_MOUSE_ENTERED: 176 case ui::ET_MOUSE_ENTERED:
179 case ui::ET_MOUSE_EXITED: { 177 case ui::ET_MOUSE_EXITED: {
180 gfx::Point location(event.location().x(), event.location().y()); 178 gfx::Point location(event.location().x(), event.location().y());
181 ui::MouseEvent ev(static_cast<ui::EventType>(event.action()), location, 179 ui::MouseEvent ev(static_cast<ui::EventType>(event.action()), location,
182 location, event.flags(), 0); 180 location, event.flags(), 0);
183 SendEventToProcessor(&ev); 181 SendEventToProcessor(&ev);
184 break; 182 break;
185 } 183 }
186 case ui::ET_KEY_PRESSED: 184 case ui::ET_KEY_PRESSED:
187 case ui::ET_KEY_RELEASED: { 185 case ui::ET_KEY_RELEASED: {
188 ui::KeyEvent ev( 186 ui::KeyEvent ev(
189 static_cast<ui::EventType>(event.action()), 187 static_cast<ui::EventType>(event.action()),
190 static_cast<ui::KeyboardCode>(event.key_data().key_code()), 188 static_cast<ui::KeyboardCode>(event.key_data().key_code()),
191 event.flags(), event.key_data().is_char()); 189 event.flags(), event.key_data().is_char());
192 SendEventToProcessor(&ev); 190 SendEventToProcessor(&ev);
193 break; 191 break;
194 } 192 }
195 // TODO(beng): touch, etc. 193 // TODO(beng): touch, etc.
196 } 194 }
195 callback.Run();
197 }; 196 };
198 197
199 } // namespace examples 198 } // namespace examples
200 } // namespace mojo 199 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/aura_demo/window_tree_host_mojo.h ('k') | mojo/examples/compositor_app/compositor_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698