Chromium Code Reviews| Index: mash/wm/window_manager_application.cc |
| diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc |
| index 9d7b1f8558d7f3a56b872f5ec6a8e3453e49f8eb..d4f1c25e02fabb5d29dfefcc60638af3678c59c1 100644 |
| --- a/mash/wm/window_manager_application.cc |
| +++ b/mash/wm/window_manager_application.cc |
| @@ -12,6 +12,8 @@ |
| #include "components/mus/public/cpp/window.h" |
| #include "components/mus/public/interfaces/window_manager_factory.mojom.h" |
| #include "mash/wm/accelerator_registrar_impl.h" |
| +#include "mash/wm/bridge/wm_globals_mus.h" |
| +#include "mash/wm/bridge/wm_lookup_mus.h" |
| #include "mash/wm/root_window_controller.h" |
| #include "mash/wm/root_windows_observer.h" |
| #include "mash/wm/shelf_layout_impl.h" |
| @@ -55,13 +57,20 @@ std::set<RootWindowController*> WindowManagerApplication::GetRootControllers() { |
| void WindowManagerApplication::OnRootWindowControllerGotRoot( |
| RootWindowController* root_controller) { |
| - aura_init_.reset(new views::AuraInit(connector_, "mash_wm_resources.pak")); |
| + if (connector_) |
| + aura_init_.reset(new views::AuraInit(connector_, "mash_wm_resources.pak")); |
| + |
| + globals_.reset(new WmGlobalsMus(root_controller->root()->connection())); |
| + lookup_.reset(new WmLookupMus); |
| } |
| void WindowManagerApplication::OnRootWindowControllerDoneInit( |
| RootWindowController* root_controller) { |
| - screen_.reset(new views::ScreenMus(nullptr)); |
| - screen_->Init(connector_); |
| + if (!screen_) { |
|
James Cook
2016/05/19 05:08:22
I'm a little confused here. This if() implies to m
sky
2016/05/19 15:14:24
Good catch. I made OnRootWindowControllerGotRoot e
|
| + std::unique_ptr<views::ScreenMus> screen(new views::ScreenMus(nullptr)); |
| + screen->Init(connector_); |
| + screen_ = std::move(screen); |
| + } |
| // TODO(msw): figure out if this should be per display, or global. |
| user_window_controller_->Initialize(root_controller); |
| @@ -111,16 +120,23 @@ void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
| accelerator_registrars_.erase(registrar); |
| } |
| +void WindowManagerApplication::AddRootWindowController( |
| + RootWindowController* root_window_controller) { |
| + root_controllers_.insert(root_window_controller); |
| +} |
| + |
| void WindowManagerApplication::Initialize(shell::Connector* connector, |
| const shell::Identity& identity, |
| uint32_t id) { |
| connector_ = connector; |
| - tracing_.Initialize(connector, identity.name()); |
| + if (connector) { |
| + tracing_.Initialize(connector, identity.name()); |
| - mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; |
| - connector_->ConnectToInterface("mojo:mus", &wm_factory_service); |
| - wm_factory_service->SetWindowManagerFactory( |
| - window_manager_factory_binding_.CreateInterfacePtrAndBind()); |
| + mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; |
| + connector_->ConnectToInterface("mojo:mus", &wm_factory_service); |
| + wm_factory_service->SetWindowManagerFactory( |
| + window_manager_factory_binding_.CreateInterfacePtrAndBind()); |
| + } |
| shelf_layout_.reset(new ShelfLayoutImpl); |
| user_window_controller_.reset(new UserWindowControllerImpl()); |
| @@ -181,7 +197,7 @@ void WindowManagerApplication::Create( |
| void WindowManagerApplication::CreateWindowManager( |
| mus::mojom::DisplayPtr display, |
| mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { |
| - root_controllers_.insert(RootWindowController::CreateFromDisplay( |
| + AddRootWindowController(RootWindowController::CreateFromDisplay( |
| this, std::move(display), std::move(client_request))); |
| } |