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

Side by Side Diff: services/clipboard/main.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 2014 The Chromium Authors. All rights reserved. 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 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 "mojo/application/application_runner_chromium.h"
6 #include "mojo/public/c/system/main.h" 5 #include "mojo/public/c/system/main.h"
7 #include "mojo/public/cpp/application/application_delegate.h" 6 #include "mojo/public/cpp/application/application_impl_base.h"
7 #include "mojo/public/cpp/application/run_application.h"
8 #include "mojo/public/cpp/application/service_provider_impl.h" 8 #include "mojo/public/cpp/application/service_provider_impl.h"
9 #include "services/clipboard/clipboard_standalone_impl.h" 9 #include "services/clipboard/clipboard_standalone_impl.h"
10 10
11 class Delegate : public mojo::ApplicationDelegate { 11 namespace {
12
13 class ClipboardApp : public mojo::ApplicationImplBase {
12 public: 14 public:
13 Delegate() {} 15 ClipboardApp() {}
14 ~Delegate() override {} 16 ~ClipboardApp() override {}
15 17
16 // mojo::ApplicationDelegate implementation. 18 // mojo::ApplicationImplBase override.
17 bool ConfigureIncomingConnection( 19 bool OnAcceptConnection(
18 mojo::ServiceProviderImpl* service_provider_impl) override { 20 mojo::ServiceProviderImpl* service_provider_impl) override {
19 service_provider_impl->AddService<mojo::Clipboard>( 21 service_provider_impl->AddService<mojo::Clipboard>(
20 [](const mojo::ConnectionContext& connection_context, 22 [](const mojo::ConnectionContext& connection_context,
21 mojo::InterfaceRequest<mojo::Clipboard> clipboard_request) { 23 mojo::InterfaceRequest<mojo::Clipboard> clipboard_request) {
22 // TODO(erg): Write native implementations of the clipboard. For now, 24 // TODO(erg): Write native implementations of the clipboard. For now,
23 // we just build a clipboard which doesn't interact with the system. 25 // we just build a clipboard which doesn't interact with the system.
24 new clipboard::ClipboardStandaloneImpl(clipboard_request.Pass()); 26 new clipboard::ClipboardStandaloneImpl(clipboard_request.Pass());
25 }); 27 });
26 return true; 28 return true;
27 } 29 }
28 }; 30 };
29 31
32 } // namespace
33
30 MojoResult MojoMain(MojoHandle application_request) { 34 MojoResult MojoMain(MojoHandle application_request) {
31 mojo::ApplicationRunnerChromium runner(new Delegate); 35 ClipboardApp clipboard_app;
32 return runner.Run(application_request); 36 return mojo::RunMainApplication(application_request, &clipboard_app);
33 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698