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

Unified Diff: mojo/services/native_viewport/main.cc

Issue 477923004: Create native_viewport_service, don't build it into mojo_shell unless Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get the static build to work Created 6 years, 4 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 | « mojo/services/native_viewport/DEPS ('k') | mojo/shell/context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/main.cc
diff --git a/mojo/services/native_viewport/main.cc b/mojo/services/native_viewport/main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e017232e06b60807ebda530c09475ea81c7c4c6f
--- /dev/null
+++ b/mojo/services/native_viewport/main.cc
@@ -0,0 +1,51 @@
+// 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 "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/message_loop/message_loop.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/services/native_viewport/native_viewport_impl.h"
+#include "ui/gl/gl_surface.h"
+
+namespace mojo {
+
+class NativeViewportAppDelegate : public ApplicationDelegate,
+ public InterfaceFactory<NativeViewport> {
+ public:
+ NativeViewportAppDelegate() {}
+ virtual ~NativeViewportAppDelegate() {}
+
+ virtual bool ConfigureIncomingConnection(
+ ApplicationConnection* connection) OVERRIDE {
+ connection->AddService(this);
+ return true;
+ }
+
+ virtual void Create(ApplicationConnection* connection,
+ InterfaceRequest<NativeViewport> request) OVERRIDE {
+ BindToRequest(new NativeViewportImpl, &request);
Ben Goodger (Google) 2014/08/15 21:59:41 Can you just use a InterfaceFactoryImpl member var
+ }
+};
+
+} // namespace mojo
+
+extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain(
+ MojoHandle shell_handle) {
+ base::CommandLine::Init(0, NULL);
+#if !defined(COMPONENT_BUILD)
+ base::AtExitManager at_exit;
+ gfx::GLSurface::InitializeOneOff();
+#endif
+
+ mojo::NativeViewportAppDelegate delegate;
+ {
+ base::MessageLoop loop(base::MessageLoop::TYPE_UI);
+ mojo::ApplicationImpl app(&delegate, shell_handle);
+ loop.Run();
+ }
+ return MOJO_RESULT_OK;
+}
« no previous file with comments | « mojo/services/native_viewport/DEPS ('k') | mojo/shell/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698