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

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

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 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
« no previous file with comments | « mojo/examples/aura_demo/root_window_host_mojo.h ('k') | mojo/examples/launcher/launcher.cc » ('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 (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/root_window_host_mojo.h" 5 #include "mojo/examples/aura_demo/root_window_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/examples/compositor_app/gles2_client_impl.h" 8 #include "mojo/examples/compositor_app/gles2_client_impl.h"
9 #include "mojo/public/bindings/allocation_scope.h" 9 #include "mojo/public/bindings/allocation_scope.h"
10 #include "mojo/public/gles2/gles2.h" 10 #include "mojo/public/gles2/gles2.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void WindowTreeHostMojo::OnDeviceScaleFactorChanged(float device_scale_factor) { 150 void WindowTreeHostMojo::OnDeviceScaleFactorChanged(float device_scale_factor) {
151 NOTIMPLEMENTED(); 151 NOTIMPLEMENTED();
152 } 152 }
153 153
154 void WindowTreeHostMojo::PrepareForShutdown() { 154 void WindowTreeHostMojo::PrepareForShutdown() {
155 NOTIMPLEMENTED(); 155 NOTIMPLEMENTED();
156 } 156 }
157 157
158 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() {
159 return delegate_->GetEventProcessor();
160 }
161
158 //////////////////////////////////////////////////////////////////////////////// 162 ////////////////////////////////////////////////////////////////////////////////
159 // WindowTreeHostMojo, NativeViewportClient implementation: 163 // WindowTreeHostMojo, NativeViewportClient implementation:
160 164
161 void WindowTreeHostMojo::OnCreated() { 165 void WindowTreeHostMojo::OnCreated() {
162 } 166 }
163 167
164 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) { 168 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) {
165 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(), 169 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(),
166 bounds.size().width(), bounds.size().height()); 170 bounds.size().width(), bounds.size().height());
167 if (delegate_) 171 if (delegate_)
(...skipping 12 matching lines...) Expand all
180 switch (event.action()) { 184 switch (event.action()) {
181 case ui::ET_MOUSE_PRESSED: 185 case ui::ET_MOUSE_PRESSED:
182 case ui::ET_MOUSE_DRAGGED: 186 case ui::ET_MOUSE_DRAGGED:
183 case ui::ET_MOUSE_RELEASED: 187 case ui::ET_MOUSE_RELEASED:
184 case ui::ET_MOUSE_MOVED: 188 case ui::ET_MOUSE_MOVED:
185 case ui::ET_MOUSE_ENTERED: 189 case ui::ET_MOUSE_ENTERED:
186 case ui::ET_MOUSE_EXITED: { 190 case ui::ET_MOUSE_EXITED: {
187 gfx::Point location(event.location().x(), event.location().y()); 191 gfx::Point location(event.location().x(), event.location().y());
188 ui::MouseEvent ev(static_cast<ui::EventType>(event.action()), location, 192 ui::MouseEvent ev(static_cast<ui::EventType>(event.action()), location,
189 location, event.flags(), 0); 193 location, event.flags(), 0);
190 delegate_->OnHostMouseEvent(&ev); 194 SendEventToProcessor(&ev);
191 break; 195 break;
192 } 196 }
193 case ui::ET_KEY_PRESSED: 197 case ui::ET_KEY_PRESSED:
194 case ui::ET_KEY_RELEASED: { 198 case ui::ET_KEY_RELEASED: {
195 ui::KeyEvent ev( 199 ui::KeyEvent ev(
196 static_cast<ui::EventType>(event.action()), 200 static_cast<ui::EventType>(event.action()),
197 static_cast<ui::KeyboardCode>(event.key_data().key_code()), 201 static_cast<ui::KeyboardCode>(event.key_data().key_code()),
198 event.flags(), event.key_data().is_char()); 202 event.flags(), event.key_data().is_char());
199 delegate_->OnHostKeyEvent(&ev); 203 SendEventToProcessor(&ev);
200 break; 204 break;
201 } 205 }
202 // TODO(beng): touch, etc. 206 // TODO(beng): touch, etc.
203 } 207 }
204 }; 208 };
205 209
206 //////////////////////////////////////////////////////////////////////////////// 210 ////////////////////////////////////////////////////////////////////////////////
207 // WindowTreeHostMojo, private: 211 // WindowTreeHostMojo, private:
208 212
209 void WindowTreeHostMojo::DidCreateContext() { 213 void WindowTreeHostMojo::DidCreateContext() {
210 context_created_ = true; 214 context_created_ = true;
211 CreateCompositorIfNeeded(); 215 CreateCompositorIfNeeded();
212 } 216 }
213 217
214 void WindowTreeHostMojo::CreateCompositorIfNeeded() { 218 void WindowTreeHostMojo::CreateCompositorIfNeeded() {
215 if (bounds_.IsEmpty() || !context_created_) 219 if (bounds_.IsEmpty() || !context_created_)
216 return; 220 return;
217 CreateCompositor(GetAcceleratedWidget()); 221 CreateCompositor(GetAcceleratedWidget());
218 compositor_created_callback_.Run(); 222 compositor_created_callback_.Run();
219 NotifyHostResized(bounds_.size()); 223 NotifyHostResized(bounds_.size());
220 } 224 }
221 225
222 } // namespace examples 226 } // namespace examples
223 } // namespace mojo 227 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/aura_demo/root_window_host_mojo.h ('k') | mojo/examples/launcher/launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698