Routes WindowManager functionality through the view manager
This is an ugly hack, but necessary until we have the ability to have
message ordering for multiple pipes.
BUG=460621
R=msw@chromium.org
Review URL: https://codereview.chromium.org/954273002
diff --git a/services/view_manager/connection_manager.cc b/services/view_manager/connection_manager.cc
index 8e06304..190c061 100644
--- a/services/view_manager/connection_manager.cc
+++ b/services/view_manager/connection_manager.cc
@@ -242,6 +242,12 @@
window_manager_client_connection_->client(), nullptr, nullptr, nullptr);
}
+mojo::ViewManagerClient*
+ConnectionManager::GetWindowManagerViewManagerClient() {
+ CHECK(window_manager_client_connection_);
+ return window_manager_client_connection_->client();
+}
+
bool ConnectionManager::CloneAndAnimate(const ViewId& view_id) {
ServerView* view = GetView(view_id);
if (!view || !view->IsDrawn(root_.get()) || view == root_.get())
diff --git a/services/view_manager/connection_manager.h b/services/view_manager/connection_manager.h
index cb61806..c8ce54e 100644
--- a/services/view_manager/connection_manager.h
+++ b/services/view_manager/connection_manager.h
@@ -124,6 +124,8 @@
return window_manager_client_connection_ != nullptr;
}
+ mojo::ViewManagerClient* GetWindowManagerViewManagerClient();
+
// WindowManagerInternalClient implementation helper; see mojom for details.
bool CloneAndAnimate(const ViewId& view_id);
diff --git a/services/view_manager/view_manager_client_apptest.cc b/services/view_manager/view_manager_client_apptest.cc
index eed4391..82e2550 100644
--- a/services/view_manager/view_manager_client_apptest.cc
+++ b/services/view_manager/view_manager_client_apptest.cc
@@ -581,9 +581,7 @@
} // namespace
-
-// TODO(msw|alhaad|sky): Fix underlying flakiness here. http://crbug.com/460621
-TEST_F(ViewManagerTest, DISABLED_Focus) {
+TEST_F(ViewManagerTest, Focus) {
View* view1 = window_manager()->CreateView();
view1->SetVisible(true);
window_manager()->GetRoot()->AddChild(view1);
diff --git a/services/view_manager/view_manager_service_apptest.cc b/services/view_manager/view_manager_service_apptest.cc
index adddc4c..0d5eddf 100644
--- a/services/view_manager/view_manager_service_apptest.cc
+++ b/services/view_manager/view_manager_service_apptest.cc
@@ -339,6 +339,9 @@
Array<uint8_t> new_data) override {
tracker_.OnViewSharedPropertyChanged(view, name, new_data.Pass());
}
+ void OnPerformAction(uint32_t view,
+ const String& name,
+ const Callback<void(bool)>& callback) override {}
TestChangeTracker tracker_;
diff --git a/services/view_manager/view_manager_service_impl.cc b/services/view_manager/view_manager_service_impl.cc
index 0c8a583..48e32c7 100644
--- a/services/view_manager/view_manager_service_impl.cc
+++ b/services/view_manager/view_manager_service_impl.cc
@@ -627,6 +627,14 @@
callback.Run(Embed(ViewIdFromTransportId(transport_view_id), client.Pass()));
}
+void ViewManagerServiceImpl::PerformAction(
+ mojo::Id transport_view_id,
+ const mojo::String& action,
+ const mojo::Callback<void(bool)>& callback) {
+ connection_manager_->GetWindowManagerViewManagerClient()->OnPerformAction(
+ transport_view_id, action, callback);
+}
+
bool ViewManagerServiceImpl::IsRootForAccessPolicy(const ViewId& id) const {
return IsRoot(id);
}
diff --git a/services/view_manager/view_manager_service_impl.h b/services/view_manager/view_manager_service_impl.h
index a315178..e92e1fa 100644
--- a/services/view_manager/view_manager_service_impl.h
+++ b/services/view_manager/view_manager_service_impl.h
@@ -210,6 +210,9 @@
void Embed(mojo::Id transport_view_id,
mojo::ViewManagerClientPtr client,
const mojo::Callback<void(bool)>& callback) override;
+ void PerformAction(mojo::Id transport_view_id,
+ const mojo::String& action,
+ const mojo::Callback<void(bool)>& callback) override;
// AccessPolicyDelegate:
bool IsRootForAccessPolicy(const ViewId& id) const override;
diff --git a/services/view_manager/view_manager_service_unittest.cc b/services/view_manager/view_manager_service_unittest.cc
index 7e95ff0..72d957a 100644
--- a/services/view_manager/view_manager_service_unittest.cc
+++ b/services/view_manager/view_manager_service_unittest.cc
@@ -99,6 +99,9 @@
const mojo::Callback<void()>& callback) override {
tracker_.OnViewInputEvent(view, event.Pass());
}
+ void OnPerformAction(uint32_t view_id,
+ const String& name,
+ const mojo::Callback<void(bool)>& callback) override {}
TestChangeTracker tracker_;