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

Side by Side Diff: services/nacl/nonsfi/content_handler_main_nexe.cc

Issue 2005103003: Add implementations of mojo::{Run,Terminate}[Main]Application() for "chromium". (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/application/content_handler_factory.h" 9 #include "mojo/application/content_handler_factory.h"
10 #include "mojo/data_pipe_utils/data_pipe_utils.h" 10 #include "mojo/data_pipe_utils/data_pipe_utils.h"
11 #include "mojo/message_pump/message_pump_mojo.h" 11 #include "mojo/message_pump/message_pump_mojo.h"
12 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" 12 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h"
13 #include "mojo/public/c/system/main.h" 13 #include "mojo/public/c/system/main.h"
14 #include "mojo/public/cpp/application/application_delegate.h" 14 #include "mojo/public/cpp/application/application_impl_base.h"
15 #include "mojo/public/cpp/application/application_impl.h" 15 #include "mojo/public/cpp/application/run_application.h"
16 16
17 namespace nacl { 17 namespace nacl {
18 namespace content_handler { 18 namespace content_handler {
19 19
20 class NaClContentHandler : public mojo::ApplicationDelegate, 20 class NaClContentHandler : public mojo::ApplicationImplBase,
21 public mojo::ContentHandlerFactory::Delegate { 21 public mojo::ContentHandlerFactory::Delegate {
22 public: 22 public:
23 NaClContentHandler() {} 23 NaClContentHandler() {}
24 24
25 private: 25 private:
26 // Overridden from ApplicationDelegate: 26 // Overridden from ApplicationImplBase:
27 void Initialize(mojo::ApplicationImpl* app) override {} 27 bool OnAcceptConnection(
28
29 // Overridden from ApplicationDelegate:
30 bool ConfigureIncomingConnection(
31 mojo::ServiceProviderImpl* service_provider_impl) override { 28 mojo::ServiceProviderImpl* service_provider_impl) override {
32 service_provider_impl->AddService<mojo::ContentHandler>( 29 service_provider_impl->AddService<mojo::ContentHandler>(
33 mojo::ContentHandlerFactory::GetInterfaceRequestHandler(this)); 30 mojo::ContentHandlerFactory::GetInterfaceRequestHandler(this));
34 return true; 31 return true;
35 } 32 }
36 33
37 // Overridden from ContentHandlerFactory::Delegate: 34 // Overridden from ContentHandlerFactory::Delegate:
38 void RunApplication( 35 void RunApplication(
39 mojo::InterfaceRequest<mojo::Application> application_request, 36 mojo::InterfaceRequest<mojo::Application> application_request,
40 mojo::URLResponsePtr response) override { 37 mojo::URLResponsePtr response) override {
(...skipping 16 matching lines...) Expand all
57 MojoLaunchNexeNonsfi(fd, handle, false /* enable_translation_irt */); 54 MojoLaunchNexeNonsfi(fd, handle, false /* enable_translation_irt */);
58 } 55 }
59 56
60 DISALLOW_COPY_AND_ASSIGN(NaClContentHandler); 57 DISALLOW_COPY_AND_ASSIGN(NaClContentHandler);
61 }; 58 };
62 59
63 } // namespace content_handler 60 } // namespace content_handler
64 } // namespace nacl 61 } // namespace nacl
65 62
66 MojoResult MojoMain(MojoHandle application_request) { 63 MojoResult MojoMain(MojoHandle application_request) {
67 mojo::ApplicationRunnerChromium runner( 64 nacl::content_handler::NaClContentHandler nacl_content_handler;
68 new nacl::content_handler::NaClContentHandler()); 65 return mojo::RunMainApplication(application_request, &nacl_content_handler);
69 return runner.Run(application_request);
70 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698