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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mash/shell/shell_application_delegate.h"
6
7 #include "base/bind.h"
8 #include "mojo/application/public/cpp/application_connection.h"
9 #include "mojo/application/public/cpp/application_impl.h"
10
11 namespace mash {
12 namespace shell {
13
14 ShellApplicationDelegate::ShellApplicationDelegate() {}
15
16 ShellApplicationDelegate::~ShellApplicationDelegate() {}
17
18 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
19 app_ = app;
20 StartWindowManager();
21 StartSystemUI();
22 }
23
24 bool ShellApplicationDelegate::ConfigureIncomingConnection(
25 mojo::ApplicationConnection* connection) {
26 return false;
27 }
28
29 void ShellApplicationDelegate::StartWindowManager() {
30 StartRestartableService(
31 "mojo:desktop_wm",
32 base::Bind(&ShellApplicationDelegate::StartWindowManager,
33 base::Unretained(this)));
34 }
35
36 void ShellApplicationDelegate::StartSystemUI() {
37 StartRestartableService("mojo:system_ui",
38 base::Bind(&ShellApplicationDelegate::StartSystemUI,
39 base::Unretained(this)));
40 }
41
42 void ShellApplicationDelegate::StartRestartableService(
43 const std::string& url,
44 const base::Closure& restart_callback) {
45 // TODO(beng): This would be the place to insert logic that counted restarts
46 // to avoid infinite crash-restart loops.
47 scoped_ptr<mojo::ApplicationConnection> connection =
48 app_->ConnectToApplication(url);
49 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback);
50 connections_[url] = std::move(connection);
51 }
52
53 } // namespace shell
54 } // namespace main
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698