Index: mash/wm/window_manager_application.cc |
diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc |
index c1b035dab84b3ef9b272881fbb1611717a070209..4f5463edae40f1c9f070d63d9b919180f878415e 100644 |
--- a/mash/wm/window_manager_application.cc |
+++ b/mash/wm/window_manager_application.cc |
@@ -14,6 +14,7 @@ |
#include "mash/wm/accelerator_registrar_impl.h" |
#include "mash/wm/root_window_controller.h" |
#include "mash/wm/root_windows_observer.h" |
+#include "mash/wm/shelf_layout.h" |
#include "mash/wm/user_window_controller_impl.h" |
#include "mojo/converters/input_events/input_events_type_converters.h" |
#include "mojo/services/tracing/public/cpp/tracing_impl.h" |
@@ -67,10 +68,20 @@ void WindowManagerApplication::OnRootWindowControllerDoneInit( |
// TODO(msw): figure out if this should be per display, or global. |
user_window_controller_->Initialize(root_controller); |
for (auto& request : user_window_controller_requests_) |
- user_window_controller_binding_.AddBinding(user_window_controller_.get(), |
- std::move(*request)); |
+ user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
+ std::move(*request)); |
user_window_controller_requests_.clear(); |
+ // TODO(msw): figure out if this should be per display, or global. |
+ if (root_controller == (*root_controllers_.begin())) { |
+ ShelfLayout* shelf_layout = |
+ static_cast<ShelfLayout*>(root_controller->GetLayoutManagerForContainer( |
+ mash::wm::mojom::Container::USER_SHELF)); |
+ for (auto& request : shelf_layout_requests_) |
+ shelf_layout_bindings_.AddBinding(shelf_layout, std::move(*request)); |
+ shelf_layout_requests_.clear(); |
+ } |
+ |
FOR_EACH_OBSERVER(RootWindowsObserver, root_windows_observers_, |
OnRootWindowControllerAdded(root_controller)); |
} |
@@ -121,7 +132,8 @@ void WindowManagerApplication::Initialize(mojo::Connector* connector, |
} |
bool WindowManagerApplication::AcceptConnection(mojo::Connection* connection) { |
- connection->AddInterface<mash::wm::mojom::UserWindowController>(this); |
+ connection->AddInterface<mojom::ShelfLayout>(this); |
+ connection->AddInterface<mojom::UserWindowController>(this); |
connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); |
if (connection->GetRemoteIdentity().name() == "mojo:mash_session") |
connection->GetInterface(&session_); |
@@ -130,13 +142,29 @@ bool WindowManagerApplication::AcceptConnection(mojo::Connection* connection) { |
void WindowManagerApplication::Create( |
mojo::Connection* connection, |
- mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> request) { |
+ mojo::InterfaceRequest<mojom::ShelfLayout> request) { |
+ // TODO(msw): Handle multiple shelves (one per display). |
+ if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { |
+ ShelfLayout* shelf_layout = static_cast<ShelfLayout*>( |
+ (*root_controllers_.begin()) |
+ ->GetLayoutManagerForContainer( |
+ mash::wm::mojom::Container::USER_SHELF)); |
+ shelf_layout_bindings_.AddBinding(shelf_layout, std::move(request)); |
+ } else { |
+ shelf_layout_requests_.push_back(make_scoped_ptr( |
+ new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request)))); |
+ } |
+} |
+ |
+void WindowManagerApplication::Create( |
+ mojo::Connection* connection, |
+ mojo::InterfaceRequest<mojom::UserWindowController> request) { |
if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { |
- user_window_controller_binding_.AddBinding(user_window_controller_.get(), |
+ user_window_controller_bindings_.AddBinding(user_window_controller_.get(), |
std::move(request)); |
} else { |
user_window_controller_requests_.push_back(base::WrapUnique( |
- new mojo::InterfaceRequest<mash::wm::mojom::UserWindowController>( |
+ new mojo::InterfaceRequest<mojom::UserWindowController>( |
std::move(request)))); |
} |
} |