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

Unified Diff: mojo/examples/surfaces_app/child_app.cc

Issue 361123002: Mojo surfaces service and example app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: mojo/examples/surfaces_app/child_app.cc
diff --git a/mojo/examples/surfaces_app/child_app.cc b/mojo/examples/surfaces_app/child_app.cc
new file mode 100644
index 0000000000000000000000000000000000000000..488ccc94df163498429a5faddb0b9d673831f5e0
--- /dev/null
+++ b/mojo/examples/surfaces_app/child_app.cc
@@ -0,0 +1,47 @@
+// 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 "mojo/examples/surfaces_app/child_impl.h"
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/bindings/string.h"
+
+namespace mojo {
+namespace examples {
+
+class ChildApp : public ApplicationDelegate, public ChildImpl::Context {
+ public:
+ ChildApp() {}
+ virtual ~ChildApp() {}
+
+ virtual void Initialize(ApplicationImpl* app) OVERRIDE { app_ = app; }
+
+ // ApplicationDelegate implementation.
+ virtual bool ConfigureIncomingConnection(
+ ApplicationConnection* connection) OVERRIDE {
+ connection->AddService<ChildImpl>(this);
+ return true;
+ }
+
+ // ChildImpl::Context implementation.
+ virtual ApplicationConnection* ShellConnection(
+ const mojo::String& application_url) OVERRIDE {
+ return app_->ConnectToApplication(application_url);
+ }
+
+ private:
+ ApplicationImpl* app_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChildApp);
+};
+
+} // namespace examples
+
+// static
+ApplicationDelegate* ApplicationDelegate::Create() {
+ return new examples::ChildApp();
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698