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

Unified Diff: apps/moterm/moterm_main.cc

Issue 1136673004: Moterm part 5: Add moterm itself. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « apps/moterm/BUILD.gn ('k') | apps/moterm/moterm_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/moterm/moterm_main.cc
diff --git a/examples/ganesh_app/ganesh_app.cc b/apps/moterm/moterm_main.cc
similarity index 57%
copy from examples/ganesh_app/ganesh_app.cc
copy to apps/moterm/moterm_main.cc
index f72323fde474f4dce23381474356de13da28e16b..afa0af333c1ddd32deabafdd114fee51f2d253f3 100644
--- a/examples/ganesh_app/ganesh_app.cc
+++ b/apps/moterm/moterm_main.cc
@@ -1,9 +1,14 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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.
+// This is the "main" for the embeddable Moterm terminal view, which provides
+// services to the thing embedding it. (This is not very useful as a "top-level"
+// application.)
+
+#include "apps/moterm/moterm_view.h"
+#include "base/logging.h"
#include "base/macros.h"
-#include "examples/ganesh_app/ganesh_view.h"
#include "mojo/application/application_runner_chromium.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_connection.h"
@@ -13,18 +18,21 @@
#include "mojo/services/view_manager/public/cpp/view_manager_client_factory.h"
#include "mojo/services/view_manager/public/cpp/view_manager_delegate.h"
-namespace examples {
+namespace {
-class GaneshApp : public mojo::ApplicationDelegate,
- public mojo::ViewManagerDelegate {
+class Moterm : public mojo::ApplicationDelegate,
+ public mojo::ViewManagerDelegate {
public:
- GaneshApp() {}
- ~GaneshApp() override {}
+ Moterm() : application_impl_() {}
+ ~Moterm() override {}
- void Initialize(mojo::ApplicationImpl* app) override {
- shell_ = app->shell();
+ private:
+ // |mojo::ApplicationDelegate|:
+ void Initialize(mojo::ApplicationImpl* application_impl) override {
+ DCHECK(!application_impl_);
+ application_impl_ = application_impl;
view_manager_client_factory_.reset(
- new mojo::ViewManagerClientFactory(app->shell(), this));
+ new mojo::ViewManagerClientFactory(application_impl_->shell(), this));
}
bool ConfigureIncomingConnection(
@@ -33,26 +41,26 @@ class GaneshApp : public mojo::ApplicationDelegate,
return true;
}
+ // |mojo::ViewManagerDelegate|:
void OnEmbed(mojo::View* root,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
mojo::ServiceProviderPtr exposed_services) override {
- new GaneshView(shell_, root);
+ new MotermView(application_impl_->shell(), root, services.Pass());
}
void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override {
base::MessageLoop::current()->Quit();
}
- private:
- mojo::Shell* shell_;
+ mojo::ApplicationImpl* application_impl_;
scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
- DISALLOW_COPY_AND_ASSIGN(GaneshApp);
+ DISALLOW_COPY_AND_ASSIGN(Moterm);
};
-} // namespace examples
+} // namespace
MojoResult MojoMain(MojoHandle application_request) {
- mojo::ApplicationRunnerChromium runner(new examples::GaneshApp);
+ mojo::ApplicationRunnerChromium runner(new Moterm());
return runner.Run(application_request);
}
« no previous file with comments | « apps/moterm/BUILD.gn ('k') | apps/moterm/moterm_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698