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

Unified Diff: mash/shell/shell_application_delegate.cc

Issue 1492563002: Introduce mash/shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
Index: mash/shell/shell_application_delegate.cc
diff --git a/mash/shell/shell_application_delegate.cc b/mash/shell/shell_application_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..da79aba5dca15175dc0303bc5497614715e72698
--- /dev/null
+++ b/mash/shell/shell_application_delegate.cc
@@ -0,0 +1,54 @@
+// 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 "mash/shell/shell_application_delegate.h"
+
+#include "base/bind.h"
+#include "mojo/application/public/cpp/application_connection.h"
+#include "mojo/application/public/cpp/application_impl.h"
+
+namespace mash {
+namespace shell {
+
+ShellApplicationDelegate::ShellApplicationDelegate() {}
+
+ShellApplicationDelegate::~ShellApplicationDelegate() {}
+
+void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
+ app_ = app;
+ StartWindowManager();
+ StartSystemUI();
+}
+
+bool ShellApplicationDelegate::ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) {
+ return false;
+}
+
+void ShellApplicationDelegate::StartWindowManager() {
+ StartRestartableService(
+ "mojo:desktop_wm",
+ base::Bind(&ShellApplicationDelegate::StartWindowManager,
+ base::Unretained(this)));
+}
+
+void ShellApplicationDelegate::StartSystemUI() {
+ StartRestartableService("mojo:system_ui",
+ base::Bind(&ShellApplicationDelegate::StartSystemUI,
+ base::Unretained(this)));
+}
+
+void ShellApplicationDelegate::StartRestartableService(
+ const std::string& url,
+ const base::Closure& restart_callback) {
+ // TODO(beng): This would be the place to insert logic that counted restarts
+ // to avoid infinite crash-restart loops.
+ scoped_ptr<mojo::ApplicationConnection> connection =
+ app_->ConnectToApplication(url);
+ connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback);
+ connections_[url] = std::move(connection);
+}
+
+} // namespace shell
+} // namespace main

Powered by Google App Engine
This is Rietveld 408576698