| 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/converters/geometry/geometry_type_converters.h" | 10 #include "mojo/converters/geometry/geometry_type_converters.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 return; | 358 return; |
| 359 } | 359 } |
| 360 view->RemoveObserver(this); | 360 view->RemoveObserver(this); |
| 361 DCHECK(it != view_id_to_window_map_.end()); | 361 DCHECK(it != view_id_to_window_map_.end()); |
| 362 // Delete before we remove from map as destruction may want to look up view | 362 // Delete before we remove from map as destruction may want to look up view |
| 363 // for window. | 363 // for window. |
| 364 delete it->second; | 364 delete it->second; |
| 365 view_id_to_window_map_.erase(it); | 365 view_id_to_window_map_.erase(it); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void WindowManagerApp::SetViewportSize(gfx::Size size) { |
| 369 window_manager_client_->SetViewportSize(Size::From(size)); |
| 370 } |
| 371 |
| 368 void WindowManagerApp::LaunchViewManager(ApplicationImpl* app) { | 372 void WindowManagerApp::LaunchViewManager(ApplicationImpl* app) { |
| 369 // TODO(sky): figure out logic if this connection goes away. | 373 // TODO(sky): figure out logic if this connection goes away. |
| 370 view_manager_client_factory_.reset( | 374 view_manager_client_factory_.reset( |
| 371 new ViewManagerClientFactory(shell_, this)); | 375 new ViewManagerClientFactory(shell_, this)); |
| 372 | 376 |
| 373 MessagePipe pipe; | 377 MessagePipe pipe; |
| 374 ApplicationConnection* view_manager_app = | 378 ApplicationConnection* view_manager_app = |
| 375 app->ConnectToApplication("mojo:view_manager"); | 379 app->ConnectToApplication("mojo:view_manager"); |
| 376 ServiceProvider* view_manager_service_provider = | 380 ServiceProvider* view_manager_service_provider = |
| 377 view_manager_app->GetServiceProvider(); | 381 view_manager_app->GetServiceProvider(); |
| 378 view_manager_service_provider->ConnectToService(ViewManagerService::Name_, | 382 view_manager_service_provider->ConnectToService(ViewManagerService::Name_, |
| 379 pipe.handle1.Pass()); | 383 pipe.handle1.Pass()); |
| 380 view_manager_client_ = ViewManagerClientFactory::WeakBindViewManagerToPipe( | 384 view_manager_client_ = ViewManagerClientFactory::WeakBindViewManagerToPipe( |
| 381 pipe.handle0.Pass(), shell_, this).Pass(); | 385 pipe.handle0.Pass(), shell_, this).Pass(); |
| 382 | 386 |
| 383 view_manager_app->AddService(&native_viewport_event_dispatcher_factory_); | 387 view_manager_app->AddService(&native_viewport_event_dispatcher_factory_); |
| 384 | 388 |
| 385 view_manager_app->ConnectToService(&window_manager_client_); | 389 view_manager_app->ConnectToService(&window_manager_client_); |
| 386 } | 390 } |
| 387 | 391 |
| 388 } // namespace mojo | 392 } // namespace mojo |
| OLD | NEW |