| 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" |
| 11 #include "mojo/public/cpp/application/application_impl.h" |
| 11 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" | 12 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
| 12 #include "mojo/services/public/cpp/view_manager/view.h" | 13 #include "mojo/services/public/cpp/view_manager/view.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 14 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
| 16 #include "ui/aura/window_property.h" | 17 #include "ui/aura/window_property.h" |
| 17 #include "ui/base/hit_test.h" | 18 #include "ui/base/hit_test.h" |
| 18 #include "ui/wm/core/capture_controller.h" | 19 #include "ui/wm/core/capture_controller.h" |
| 19 #include "ui/wm/core/focus_controller.h" | 20 #include "ui/wm/core/focus_controller.h" |
| 20 #include "ui/wm/core/focus_rules.h" | 21 #include "ui/wm/core/focus_rules.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
| 113 // WindowManagerApp, public: | 114 // WindowManagerApp, public: |
| 114 | 115 |
| 115 WindowManagerApp::WindowManagerApp( | 116 WindowManagerApp::WindowManagerApp( |
| 116 ViewManagerDelegate* view_manager_delegate, | 117 ViewManagerDelegate* view_manager_delegate, |
| 117 WindowManagerDelegate* window_manager_delegate) | 118 WindowManagerDelegate* window_manager_delegate) |
| 118 : window_manager_service_factory_(this), | 119 : window_manager_service_factory_(this), |
| 119 wrapped_view_manager_delegate_(view_manager_delegate), | 120 wrapped_view_manager_delegate_(view_manager_delegate), |
| 120 wrapped_window_manager_delegate_(window_manager_delegate), | 121 wrapped_window_manager_delegate_(window_manager_delegate), |
| 121 view_manager_(NULL), | 122 view_manager_(NULL), |
| 122 view_manager_client_factory_(this), | |
| 123 root_(NULL), | 123 root_(NULL), |
| 124 dummy_delegate_(new DummyDelegate) { | 124 dummy_delegate_(new DummyDelegate) { |
| 125 } | 125 } |
| 126 | 126 |
| 127 WindowManagerApp::~WindowManagerApp() {} | 127 WindowManagerApp::~WindowManagerApp() {} |
| 128 | 128 |
| 129 // static | 129 // static |
| 130 View* WindowManagerApp::GetViewForWindow(aura::Window* window) { | 130 View* WindowManagerApp::GetViewForWindow(aura::Window* window) { |
| 131 return window->GetProperty(kViewKey); | 131 return window->GetProperty(kViewKey); |
| 132 } | 132 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 161 | 161 |
| 162 bool WindowManagerApp::IsReady() const { | 162 bool WindowManagerApp::IsReady() const { |
| 163 return view_manager_ && root_; | 163 return view_manager_ && root_; |
| 164 } | 164 } |
| 165 | 165 |
| 166 //////////////////////////////////////////////////////////////////////////////// | 166 //////////////////////////////////////////////////////////////////////////////// |
| 167 // WindowManagerApp, ApplicationDelegate implementation: | 167 // WindowManagerApp, ApplicationDelegate implementation: |
| 168 | 168 |
| 169 void WindowManagerApp::Initialize(ApplicationImpl* impl) { | 169 void WindowManagerApp::Initialize(ApplicationImpl* impl) { |
| 170 aura_init_.reset(new AuraInit); | 170 aura_init_.reset(new AuraInit); |
| 171 view_manager_client_factory_.reset( |
| 172 new ViewManagerClientFactory(impl->shell(), this)); |
| 171 } | 173 } |
| 172 | 174 |
| 173 bool WindowManagerApp::ConfigureIncomingConnection( | 175 bool WindowManagerApp::ConfigureIncomingConnection( |
| 174 ApplicationConnection* connection) { | 176 ApplicationConnection* connection) { |
| 175 connection->AddService(&window_manager_service_factory_); | 177 connection->AddService(&window_manager_service_factory_); |
| 176 connection->AddService(&view_manager_client_factory_); | 178 connection->AddService(view_manager_client_factory_.get()); |
| 177 return true; | 179 return true; |
| 178 } | 180 } |
| 179 | 181 |
| 180 //////////////////////////////////////////////////////////////////////////////// | 182 //////////////////////////////////////////////////////////////////////////////// |
| 181 // WindowManagerApp, ViewManagerDelegate implementation: | 183 // WindowManagerApp, ViewManagerDelegate implementation: |
| 182 | 184 |
| 183 void WindowManagerApp::OnEmbed(ViewManager* view_manager, | 185 void WindowManagerApp::OnEmbed(ViewManager* view_manager, |
| 184 View* root, | 186 View* root, |
| 185 ServiceProviderImpl* exported_services, | 187 ServiceProviderImpl* exported_services, |
| 186 scoped_ptr<ServiceProvider> imported_services) { | 188 scoped_ptr<ServiceProvider> imported_services) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(view->id()); | 362 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(view->id()); |
| 361 DCHECK(it != view_id_to_window_map_.end()); | 363 DCHECK(it != view_id_to_window_map_.end()); |
| 362 scoped_ptr<aura::Window> window(it->second); | 364 scoped_ptr<aura::Window> window(it->second); |
| 363 view_id_to_window_map_.erase(it); | 365 view_id_to_window_map_.erase(it); |
| 364 View::Children::const_iterator child = view->children().begin(); | 366 View::Children::const_iterator child = view->children().begin(); |
| 365 for (; child != view->children().end(); ++child) | 367 for (; child != view->children().end(); ++child) |
| 366 UnregisterSubtree(*child); | 368 UnregisterSubtree(*child); |
| 367 } | 369 } |
| 368 | 370 |
| 369 } // namespace mojo | 371 } // namespace mojo |
| OLD | NEW |