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

Side by Side Diff: apps/moterm/moterm_main.cc

Issue 1556683004: Port Moterm to Mozart. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-16
Patch Set: fix nits Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « apps/moterm/moterm_app.cc ('k') | apps/moterm/moterm_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This is the "main" for the embeddable Moterm terminal view, which provides
6 // services to the thing embedding it. (This is not very useful as a "top-level"
7 // application.)
8
9 #include "apps/moterm/moterm_view.h"
10 #include "base/logging.h"
11 #include "base/macros.h"
12 #include "mojo/application/application_runner_chromium.h"
13 #include "mojo/public/c/system/main.h"
14 #include "mojo/public/cpp/application/application_connection.h"
15 #include "mojo/public/cpp/application/application_delegate.h"
16 #include "mojo/public/cpp/application/application_impl.h"
17 #include "mojo/services/view_manager/cpp/view_manager.h"
18 #include "mojo/services/view_manager/cpp/view_manager_client_factory.h"
19 #include "mojo/services/view_manager/cpp/view_manager_delegate.h"
20
21 namespace {
22
23 class Moterm : public mojo::ApplicationDelegate,
24 public mojo::ViewManagerDelegate {
25 public:
26 Moterm() : application_impl_() {}
27 ~Moterm() override {}
28
29 private:
30 // |mojo::ApplicationDelegate|:
31 void Initialize(mojo::ApplicationImpl* application_impl) override {
32 DCHECK(!application_impl_);
33 application_impl_ = application_impl;
34 view_manager_client_factory_.reset(
35 new mojo::ViewManagerClientFactory(application_impl_->shell(), this));
36 }
37
38 bool ConfigureIncomingConnection(
39 mojo::ApplicationConnection* connection) override {
40 connection->AddService(view_manager_client_factory_.get());
41 return true;
42 }
43
44 // |mojo::ViewManagerDelegate|:
45 void OnEmbed(mojo::View* root,
46 mojo::InterfaceRequest<mojo::ServiceProvider> services,
47 mojo::ServiceProviderPtr exposed_services) override {
48 new MotermView(application_impl_->shell(), root, services.Pass());
49 }
50
51 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override {
52 }
53
54 mojo::ApplicationImpl* application_impl_;
55 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(Moterm);
58 };
59
60 } // namespace
61
62 MojoResult MojoMain(MojoHandle application_request) {
63 mojo::ApplicationRunnerChromium runner(new Moterm());
64 return runner.Run(application_request);
65 }
OLDNEW
« no previous file with comments | « apps/moterm/moterm_app.cc ('k') | apps/moterm/moterm_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698