OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 "base/at_exit.h" | |
6 #include "base/command_line.h" | |
7 #include "base/message_loop/message_loop.h" | |
8 #include "mojo/public/cpp/application/application_connection.h" | |
9 #include "mojo/public/cpp/application/application_delegate.h" | |
10 #include "mojo/public/cpp/application/application_impl.h" | |
11 #include "mojo/services/native_viewport/native_viewport_impl.h" | |
12 #include "ui/gl/gl_surface.h" | |
13 | |
14 namespace mojo { | |
15 | |
16 class NativeViewportAppDelegate : public ApplicationDelegate, | |
17 public InterfaceFactory<NativeViewport> { | |
18 public: | |
19 NativeViewportAppDelegate() {} | |
20 virtual ~NativeViewportAppDelegate() {} | |
21 | |
22 virtual bool ConfigureIncomingConnection( | |
23 ApplicationConnection* connection) OVERRIDE { | |
24 connection->AddService(this); | |
25 return true; | |
26 } | |
27 | |
28 virtual void Create(ApplicationConnection* connection, | |
29 InterfaceRequest<NativeViewport> request) OVERRIDE { | |
30 BindToRequest(new NativeViewportImpl, &request); | |
Ben Goodger (Google)
2014/08/15 21:59:41
Can you just use a InterfaceFactoryImpl member var
| |
31 } | |
32 }; | |
33 | |
34 } // namespace mojo | |
35 | |
36 extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( | |
37 MojoHandle shell_handle) { | |
38 base::CommandLine::Init(0, NULL); | |
39 #if !defined(COMPONENT_BUILD) | |
40 base::AtExitManager at_exit; | |
41 gfx::GLSurface::InitializeOneOff(); | |
42 #endif | |
43 | |
44 mojo::NativeViewportAppDelegate delegate; | |
45 { | |
46 base::MessageLoop loop(base::MessageLoop::TYPE_UI); | |
47 mojo::ApplicationImpl app(&delegate, shell_handle); | |
48 loop.Run(); | |
49 } | |
50 return MOJO_RESULT_OK; | |
51 } | |
OLD | NEW |