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

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

Issue 188223002: Clean up WindowEventDispatcher some more. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | 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/gles2/gles2.h" 9 #include "mojo/public/gles2/gles2.h"
10 #include "mojo/services/native_viewport/geometry_conversions.h" 10 #include "mojo/services/native_viewport/geometry_conversions.h"
11 #include "ui/aura/env.h" 11 #include "ui/aura/env.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/aura/window_tree_host_delegate.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/compositor/compositor.h" 14 #include "ui/compositor/compositor.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 #include "ui/events/event_constants.h" 16 #include "ui/events/event_constants.h"
17 #include "ui/gfx/geometry/insets.h" 17 #include "ui/gfx/geometry/insets.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 19
20 namespace mojo { 20 namespace mojo {
21 namespace examples { 21 namespace examples {
22 22
23 // static 23 // static
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { 143 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) {
144 NOTIMPLEMENTED(); 144 NOTIMPLEMENTED();
145 } 145 }
146 146
147 //////////////////////////////////////////////////////////////////////////////// 147 ////////////////////////////////////////////////////////////////////////////////
148 // WindowTreeHostMojo, ui::EventSource implementation: 148 // WindowTreeHostMojo, ui::EventSource implementation:
149 149
150 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { 150 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() {
151 return delegate_->GetEventProcessor(); 151 return dispatcher();
152 } 152 }
153 153
154 //////////////////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////////////////
155 // WindowTreeHostMojo, NativeViewportClient implementation: 155 // WindowTreeHostMojo, NativeViewportClient implementation:
156 156
157 void WindowTreeHostMojo::OnCreated() { 157 void WindowTreeHostMojo::OnCreated() {
158 CreateCompositor(GetAcceleratedWidget()); 158 CreateCompositor(GetAcceleratedWidget());
159 compositor_created_callback_.Run(); 159 compositor_created_callback_.Run();
160 } 160 }
161 161
162 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) { 162 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) {
163 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(), 163 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(),
164 bounds.size().width(), bounds.size().height()); 164 bounds.size().width(), bounds.size().height());
165 if (delegate_) 165 window()->SetBounds(gfx::Rect(bounds_.size()));
166 window()->SetBounds(gfx::Rect(bounds_.size()));
167 OnHostResized(bounds_.size()); 166 OnHostResized(bounds_.size());
168 } 167 }
169 168
170 void WindowTreeHostMojo::OnDestroyed() { 169 void WindowTreeHostMojo::OnDestroyed() {
171 base::MessageLoop::current()->Quit(); 170 base::MessageLoop::current()->Quit();
172 } 171 }
173 172
174 void WindowTreeHostMojo::OnEvent(const Event& event) { 173 void WindowTreeHostMojo::OnEvent(const Event& event) {
175 if (!event.location().is_null()) 174 if (!event.location().is_null())
176 native_viewport_->AckEvent(event); 175 native_viewport_->AckEvent(event);
(...skipping 19 matching lines...) Expand all
196 event.flags(), event.key_data().is_char()); 195 event.flags(), event.key_data().is_char());
197 SendEventToProcessor(&ev); 196 SendEventToProcessor(&ev);
198 break; 197 break;
199 } 198 }
200 // TODO(beng): touch, etc. 199 // TODO(beng): touch, etc.
201 } 200 }
202 }; 201 };
203 202
204 } // namespace examples 203 } // namespace examples
205 } // namespace mojo 204 } // namespace mojo
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc ('k') | ui/app_list/views/app_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698