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

Side by Side Diff: mojo/services/view_manager/window_tree_host_impl.cc

Issue 474883003: Move focus from the view manager to the window manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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/services/view_manager/window_tree_host_impl.h ('k') | mojo/services/window_manager/DEPS » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/services/view_manager/root_node_manager.h" 5 #include "mojo/services/view_manager/root_node_manager.h"
6 #include "mojo/services/view_manager/window_tree_host_impl.h" 6 #include "mojo/services/view_manager/window_tree_host_impl.h"
7 #include "mojo/public/c/gles2/gles2.h" 7 #include "mojo/public/c/gles2/gles2.h"
8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" 9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
10 #include "mojo/services/view_manager/context_factory_impl.h" 10 #include "mojo/services/view_manager/context_factory_impl.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size())); 62 SetChildBoundsDirect(child, gfx::Rect(requested_bounds.size()));
63 } 63 }
64 64
65 //////////////////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////////////////
66 // WindowTreeHostImpl, public: 66 // WindowTreeHostImpl, public:
67 67
68 WindowTreeHostImpl::WindowTreeHostImpl( 68 WindowTreeHostImpl::WindowTreeHostImpl(
69 NativeViewportPtr viewport, 69 NativeViewportPtr viewport,
70 const gfx::Rect& bounds, 70 const gfx::Rect& bounds,
71 const Callback<void()>& compositor_created_callback, 71 const Callback<void()>& compositor_created_callback,
72 const Callback<void()>& native_viewport_closed_callback) 72 const Callback<void()>& native_viewport_closed_callback,
73 const Callback<void(EventPtr)>& event_received_callback)
73 : native_viewport_(viewport.Pass()), 74 : native_viewport_(viewport.Pass()),
74 compositor_created_callback_(compositor_created_callback), 75 compositor_created_callback_(compositor_created_callback),
75 native_viewport_closed_callback_(native_viewport_closed_callback), 76 native_viewport_closed_callback_(native_viewport_closed_callback),
77 event_received_callback_(event_received_callback),
76 bounds_(bounds) { 78 bounds_(bounds) {
77 native_viewport_.set_client(this); 79 native_viewport_.set_client(this);
78 native_viewport_->Create(Rect::From(bounds)); 80 native_viewport_->Create(Rect::From(bounds));
79 81
80 MessagePipe pipe; 82 MessagePipe pipe;
81 native_viewport_->CreateGLES2Context( 83 native_viewport_->CreateGLES2Context(
82 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); 84 MakeRequest<CommandBuffer>(pipe.handle0.Pass()));
83 85
84 // The ContextFactory must exist before any Compositors are created. 86 // The ContextFactory must exist before any Compositors are created.
85 if (context_factory_) { 87 if (context_factory_) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 180
179 void WindowTreeHostImpl::OnDestroyed(const mojo::Callback<void()>& callback) { 181 void WindowTreeHostImpl::OnDestroyed(const mojo::Callback<void()>& callback) {
180 DestroyCompositor(); 182 DestroyCompositor();
181 native_viewport_closed_callback_.Run(); 183 native_viewport_closed_callback_.Run();
182 // TODO(beng): quit the message loop once we are on our own thread. 184 // TODO(beng): quit the message loop once we are on our own thread.
183 callback.Run(); 185 callback.Run();
184 } 186 }
185 187
186 void WindowTreeHostImpl::OnEvent(EventPtr event, 188 void WindowTreeHostImpl::OnEvent(EventPtr event,
187 const mojo::Callback<void()>& callback) { 189 const mojo::Callback<void()>& callback) {
188 scoped_ptr<ui::Event> ui_event = 190 event_received_callback_.Run(event.Pass());
189 TypeConverter<EventPtr, scoped_ptr<ui::Event> >::ConvertTo(event);
190 if (ui_event)
191 SendEventToProcessor(ui_event.get());
192 callback.Run(); 191 callback.Run();
193 }; 192 };
194 193
195 } // namespace service 194 } // namespace service
196 } // namespace mojo 195 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/window_tree_host_impl.h ('k') | mojo/services/window_manager/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698