Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: mojo/services/view_manager/connection_manager.cc

Issue 685013002: Refactors event dispatching of NativeViewport into its own interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/connection_manager.h ('k') | mojo/services/view_manager/display_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/connection_manager.cc
diff --git a/mojo/services/view_manager/connection_manager.cc b/mojo/services/view_manager/connection_manager.cc
index 253cc76f79dd56f187cc938254f073ef8ae58673..120e491f7dab36e4d01288a29d473798187ca516 100644
--- a/mojo/services/view_manager/connection_manager.cc
+++ b/mojo/services/view_manager/connection_manager.cc
@@ -15,6 +15,29 @@
namespace mojo {
namespace service {
+class WindowManagerInternalClientImpl
+ : public InterfaceImpl<WindowManagerInternalClient> {
+ public:
+ WindowManagerInternalClientImpl(WindowManagerInternalClient* real_client,
+ ErrorHandler* error_handler)
+ : real_client_(real_client), error_handler_(error_handler) {}
+ ~WindowManagerInternalClientImpl() override {}
+
+ // WindowManagerInternalClient:
+ void DispatchInputEventToView(Id transport_view_id, EventPtr event) override {
+ real_client_->DispatchInputEventToView(transport_view_id, event.Pass());
+ }
+
+ // InterfaceImpl:
+ void OnConnectionError() override { error_handler_->OnConnectionError(); }
+
+ private:
+ WindowManagerInternalClient* real_client_;
+ ErrorHandler* error_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowManagerInternalClientImpl);
+};
+
ConnectionManager::ScopedChange::ScopedChange(
ViewManagerServiceImpl* connection,
ConnectionManager* connection_manager,
@@ -43,12 +66,12 @@ ConnectionManager::ConnectionManager(ApplicationConnection* app_connection,
root_(new ServerView(this, RootViewId())),
current_change_(NULL),
in_destructor_(false) {
- app_connection->ConnectToService(&window_manager_);
- window_manager_.set_client(this);
- window_manager_.set_error_handler(this);
// |app_connection| originates from the WindowManager. Let it connect
- // directly to the ViewManager.
- app_connection->AddService(this);
+ // directly to the ViewManager and WindowManagerInternalClient.
+ app_connection->AddService(
+ static_cast<InterfaceFactory<ViewManagerService>*>(this));
+ app_connection->AddService(
+ static_cast<InterfaceFactory<WindowManagerInternalClient>*>(this));
root_->SetBounds(gfx::Rect(800, 600));
}
@@ -149,10 +172,6 @@ const ViewManagerServiceImpl* ConnectionManager::GetConnectionWithRoot(
return NULL;
}
-void ConnectionManager::DispatchViewInputEventToDelegate(EventPtr event) {
- window_manager_->OnViewInputEvent(event.Pass());
-}
-
void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
@@ -336,6 +355,19 @@ void ConnectionManager::Create(ApplicationConnection* connection,
WeakBindToRequest(window_manager_vm_service_, &request);
}
+void ConnectionManager::Create(
+ ApplicationConnection* connection,
+ InterfaceRequest<WindowManagerInternalClient> request) {
+ if (wm_internal_client_impl_.get()) {
+ VLOG(1) << "WindowManagerInternalClient requested more than once.";
+ return;
+ }
+
+ wm_internal_client_impl_.reset(
+ new WindowManagerInternalClientImpl(this, this));
+ WeakBindToRequest(wm_internal_client_impl_.get(), &request);
+}
+
void ConnectionManager::OnConnectionError() {
delegate_->OnLostConnectionToWindowManager();
}
« no previous file with comments | « mojo/services/view_manager/connection_manager.h ('k') | mojo/services/view_manager/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698