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

Unified Diff: services/view_manager/view_manager_app.cc

Issue 1536713004: Revert "Delete the ViewManager and WindowManager services." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « services/view_manager/view_manager_app.h ('k') | services/view_manager/view_manager_client_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/view_manager/view_manager_app.cc
diff --git a/services/view_manager/view_manager_app.cc b/services/view_manager/view_manager_app.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d4965aac904b8c46018eaed37bad03784a13025b
--- /dev/null
+++ b/services/view_manager/view_manager_app.cc
@@ -0,0 +1,58 @@
+// Copyright 2014 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 "services/view_manager/view_manager_app.h"
+
+#include "base/trace_event/trace_event.h"
+#include "mojo/application/application_runner_chromium.h"
+#include "mojo/common/tracing_impl.h"
+#include "mojo/public/c/system/main.h"
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/application_impl.h"
+#include "services/view_manager/view_manager_root_connection.h"
+
+using mojo::ApplicationConnection;
+using mojo::ApplicationImpl;
+using mojo::InterfaceRequest;
+using mojo::ViewManagerService;
+using mojo::WindowManagerInternalClient;
+
+namespace view_manager {
+
+ViewManagerApp::ViewManagerApp() : app_impl_(nullptr) {}
+
+ViewManagerApp::~ViewManagerApp() {}
+
+void ViewManagerApp::Initialize(ApplicationImpl* app) {
+ app_impl_ = app;
+ tracing_.Initialize(app);
+ TRACE_EVENT0("view_manager", __func__);
+}
+
+bool ViewManagerApp::ConfigureIncomingConnection(
+ ApplicationConnection* connection) {
+ TRACE_EVENT0("view_manager", __func__);
+ // We keep a raw pointer in active_root_connections_ in order to be able to
+ // close the ViewManagerApp when all outstanding ViewManagerRootConnections
+ // are closed. ViewManagerRootConnection manages its own lifetime.
+ ViewManagerRootConnection* root_connection =
+ new ViewManagerRootConnection(app_impl_, this);
+ if (root_connection->Init(connection)) {
+ active_root_connections_.insert(root_connection);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void ViewManagerApp::OnCloseViewManagerRootConnection(
+ ViewManagerRootConnection* view_manager_root_connection) {
+ active_root_connections_.erase(view_manager_root_connection);
+
+ if (active_root_connections_.size() == 0) {
+ ApplicationImpl::Terminate();
+ }
+}
+
+} // namespace view_manager
« no previous file with comments | « services/view_manager/view_manager_app.h ('k') | services/view_manager/view_manager_client_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698