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 "components/window_manager/window_manager_app.h" | 5 #include "components/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 "components/view_manager/public/cpp/view.h" | 9 #include "components/view_manager/public/cpp/view.h" |
10 #include "components/view_manager/public/cpp/view_manager.h" | 10 #include "components/view_manager/public/cpp/view_manager.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 void WindowManagerApp::LaunchViewManager(mojo::ApplicationImpl* app) { | 159 void WindowManagerApp::LaunchViewManager(mojo::ApplicationImpl* app) { |
160 // TODO(sky): figure out logic if this connection goes away. | 160 // TODO(sky): figure out logic if this connection goes away. |
161 view_manager_client_factory_.reset( | 161 view_manager_client_factory_.reset( |
162 new mojo::ViewManagerClientFactory(shell_, this)); | 162 new mojo::ViewManagerClientFactory(shell_, this)); |
163 | 163 |
164 ApplicationConnection* view_manager_app = | 164 ApplicationConnection* view_manager_app = |
165 app->ConnectToApplication("mojo:view_manager"); | 165 app->ConnectToApplication("mojo:view_manager"); |
166 view_manager_app->ConnectToService(&view_manager_service_); | 166 view_manager_app->ConnectToService(&view_manager_service_); |
| 167 view_manager_service_.set_error_handler(this); |
167 | 168 |
168 view_manager_app->AddService<WindowManagerInternal>(this); | 169 view_manager_app->AddService<WindowManagerInternal>(this); |
169 | 170 |
170 view_manager_app->ConnectToService(&window_manager_client_); | 171 view_manager_app->ConnectToService(&window_manager_client_); |
171 } | 172 } |
172 | 173 |
173 void WindowManagerApp::Create( | 174 void WindowManagerApp::Create( |
174 ApplicationConnection* connection, | 175 ApplicationConnection* connection, |
175 mojo::InterfaceRequest<WindowManagerInternal> request) { | 176 mojo::InterfaceRequest<WindowManagerInternal> request) { |
176 if (wm_internal_binding_.get()) { | 177 if (wm_internal_binding_.get()) { |
(...skipping 21 matching lines...) Expand all Loading... |
198 view_manager_client_request.Pass()), | 199 view_manager_client_request.Pass()), |
199 view_manager_service_.Pass(), shell_, this)); | 200 view_manager_service_.Pass(), shell_, this)); |
200 } | 201 } |
201 | 202 |
202 void WindowManagerApp::OnAccelerator(mojo::EventPtr event) { | 203 void WindowManagerApp::OnAccelerator(mojo::EventPtr event) { |
203 window_manager_delegate_->OnAcceleratorPressed( | 204 window_manager_delegate_->OnAcceleratorPressed( |
204 root_->view_manager()->GetFocusedView(), | 205 root_->view_manager()->GetFocusedView(), |
205 event->key_data->windows_key_code, event->flags); | 206 event->key_data->windows_key_code, event->flags); |
206 } | 207 } |
207 | 208 |
| 209 void WindowManagerApp::OnConnectionError() { |
| 210 mojo::ApplicationImpl::Terminate(); |
| 211 } |
| 212 |
208 } // namespace window_manager | 213 } // namespace window_manager |
OLD | NEW |