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

Unified Diff: components/view_manager/public/cpp/lib/view_manager_init.cc

Issue 1138073007: Nukes the windowmanager interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 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
Index: components/view_manager/public/cpp/lib/view_manager_init.cc
diff --git a/components/view_manager/public/cpp/lib/view_manager_init.cc b/components/view_manager/public/cpp/lib/view_manager_init.cc
new file mode 100644
index 0000000000000000000000000000000000000000..669cdb9dde45f12b89959678aa4a3678561e4077
--- /dev/null
+++ b/components/view_manager/public/cpp/lib/view_manager_init.cc
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/view_manager/public/cpp/view_manager_init.h"
+
+#include "components/view_manager/public/cpp/lib/view_manager_client_impl.h"
+#include "mojo/application/public/cpp/application_impl.h"
+
+namespace mojo {
+
+class ViewManagerInit::ClientFactory
+ : public InterfaceFactory<ViewManagerClient> {
+ public:
+ ClientFactory(ViewManagerInit* init) : init_(init) {}
+ ~ClientFactory() override {}
+
+ // InterfaceFactory<ViewManagerClient> implementation.
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<ViewManagerClient> request) override {
+ init_->OnCreate(request.Pass());
+ }
+
+ private:
+ ViewManagerInit* init_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientFactory);
+};
+
+ViewManagerInit::ViewManagerInit(ApplicationImpl* app,
+ ViewManagerDelegate* delegate,
+ ViewManagerRootClient* root_client)
+ : app_(app), delegate_(delegate), client_factory_(new ClientFactory(this)) {
+ ApplicationConnection* connection =
+ app_->ConnectToApplication("mojo:view_manager");
+ connection->AddService(client_factory_.get());
+ connection->ConnectToService(&service_);
+ connection->ConnectToService(&view_manager_root_);
+ if (root_client) {
+ root_client_binding_.reset(new Binding<ViewManagerRootClient>(root_client));
+ ViewManagerRootClientPtr root_client_ptr;
+ root_client_binding_->Bind(GetProxy(&root_client_ptr));
+ view_manager_root_->SetViewManagerRootClient(root_client_ptr.Pass());
+ }
+}
+
+ViewManagerInit::~ViewManagerInit() {
+}
+
+void ViewManagerInit::OnCreate(InterfaceRequest<ViewManagerClient> request) {
+ // TODO(sky): straighten out lifetime.
+ const bool delete_on_error = false;
+ ViewManagerClientImpl* client = new ViewManagerClientImpl(
+ delegate_, app_->shell(), request.Pass(), delete_on_error);
+ client->SetViewManagerService(service_.Pass());
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698