OLD | NEW |
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 "mojo/services/window_manager/window_manager_app.h" | 5 #include "mojo/services/window_manager/window_manager_app.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/aura/aura_init.h" | 9 #include "mojo/aura/aura_init.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // WindowManagerApp, WindowManagerDelegate implementation: | 230 // WindowManagerApp, WindowManagerDelegate implementation: |
231 | 231 |
232 void WindowManagerApp::Embed( | 232 void WindowManagerApp::Embed( |
233 const String& url, | 233 const String& url, |
234 InterfaceRequest<ServiceProvider> service_provider) { | 234 InterfaceRequest<ServiceProvider> service_provider) { |
235 if (wrapped_window_manager_delegate_) | 235 if (wrapped_window_manager_delegate_) |
236 wrapped_window_manager_delegate_->Embed(url, service_provider.Pass()); | 236 wrapped_window_manager_delegate_->Embed(url, service_provider.Pass()); |
237 } | 237 } |
238 | 238 |
239 void WindowManagerApp::DispatchEvent(EventPtr event) { | 239 void WindowManagerApp::DispatchEvent(EventPtr event) { |
240 scoped_ptr<ui::Event> ui_event = | 240 scoped_ptr<ui::Event> ui_event = event.To<scoped_ptr<ui::Event> >(); |
241 TypeConverter<EventPtr, scoped_ptr<ui::Event> >::ConvertTo(event); | |
242 if (ui_event) | 241 if (ui_event) |
243 window_tree_host_->SendEventToProcessor(ui_event.get()); | 242 window_tree_host_->SendEventToProcessor(ui_event.get()); |
244 } | 243 } |
245 | 244 |
246 //////////////////////////////////////////////////////////////////////////////// | 245 //////////////////////////////////////////////////////////////////////////////// |
247 // WindowManagerApp, ViewObserver implementation: | 246 // WindowManagerApp, ViewObserver implementation: |
248 | 247 |
249 void WindowManagerApp::OnTreeChanged( | 248 void WindowManagerApp::OnTreeChanged( |
250 const ViewObserver::TreeChangeParams& params) { | 249 const ViewObserver::TreeChangeParams& params) { |
251 if (params.receiver != root_) | 250 if (params.receiver != root_) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 void WindowManagerApp::CompositorContentsChanged(const SkBitmap& bitmap) { | 293 void WindowManagerApp::CompositorContentsChanged(const SkBitmap& bitmap) { |
295 // We draw nothing. | 294 // We draw nothing. |
296 NOTREACHED(); | 295 NOTREACHED(); |
297 } | 296 } |
298 | 297 |
299 //////////////////////////////////////////////////////////////////////////////// | 298 //////////////////////////////////////////////////////////////////////////////// |
300 // WindowManagerApp, ui::EventHandler implementation: | 299 // WindowManagerApp, ui::EventHandler implementation: |
301 | 300 |
302 void WindowManagerApp::OnEvent(ui::Event* event) { | 301 void WindowManagerApp::OnEvent(ui::Event* event) { |
303 aura::Window* window = static_cast<aura::Window*>(event->target()); | 302 aura::Window* window = static_cast<aura::Window*>(event->target()); |
304 view_manager_->DispatchEvent( | 303 view_manager_->DispatchEvent(GetViewForWindow(window), Event::From(*event)); |
305 GetViewForWindow(window), | |
306 TypeConverter<EventPtr, ui::Event>::ConvertFrom(*event)); | |
307 } | 304 } |
308 | 305 |
309 //////////////////////////////////////////////////////////////////////////////// | 306 //////////////////////////////////////////////////////////////////////////////// |
310 // WindowManagerApp, aura::client::FocusChangeObserver implementation: | 307 // WindowManagerApp, aura::client::FocusChangeObserver implementation: |
311 | 308 |
312 void WindowManagerApp::OnWindowFocused(aura::Window* gained_focus, | 309 void WindowManagerApp::OnWindowFocused(aura::Window* gained_focus, |
313 aura::Window* lost_focus) { | 310 aura::Window* lost_focus) { |
314 for (Connections::const_iterator it = connections_.begin(); | 311 for (Connections::const_iterator it = connections_.begin(); |
315 it != connections_.end(); ++it) { | 312 it != connections_.end(); ++it) { |
316 (*it)->NotifyViewFocused(GetIdForWindow(gained_focus), | 313 (*it)->NotifyViewFocused(GetIdForWindow(gained_focus), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(view->id()); | 360 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(view->id()); |
364 DCHECK(it != view_id_to_window_map_.end()); | 361 DCHECK(it != view_id_to_window_map_.end()); |
365 scoped_ptr<aura::Window> window(it->second); | 362 scoped_ptr<aura::Window> window(it->second); |
366 view_id_to_window_map_.erase(it); | 363 view_id_to_window_map_.erase(it); |
367 View::Children::const_iterator child = view->children().begin(); | 364 View::Children::const_iterator child = view->children().begin(); |
368 for (; child != view->children().end(); ++child) | 365 for (; child != view->children().end(); ++child) |
369 UnregisterSubtree(*child); | 366 UnregisterSubtree(*child); |
370 } | 367 } |
371 | 368 |
372 } // namespace mojo | 369 } // namespace mojo |
OLD | NEW |