| OLD | NEW |
| 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" | 5 #include "mojo/application/application_runner_chromium.h" |
| 6 #include "mojo/public/c/system/main.h" | 6 #include "mojo/public/c/system/main.h" |
| 7 #include "mojo/public/cpp/application/application_connection.h" | 7 #include "mojo/public/cpp/application/application_connection.h" |
| 8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.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 class Delegate : public mojo::ApplicationDelegate { |
| 12 public: | 12 public: |
| 13 Delegate() {} | 13 Delegate() {} |
| 14 ~Delegate() override {} | 14 ~Delegate() override {} |
| 15 | 15 |
| 16 // mojo::ApplicationDelegate implementation. | 16 // mojo::ApplicationDelegate implementation. |
| 17 bool ConfigureIncomingConnection( | 17 bool ConfigureIncomingConnection( |
| 18 mojo::ApplicationConnection* connection) override { | 18 mojo::ServiceProviderImpl* service_provider_impl) override { |
| 19 connection->GetServiceProviderImpl().AddService<mojo::Clipboard>( | 19 service_provider_impl->AddService<mojo::Clipboard>( |
| 20 [](const mojo::ConnectionContext& connection_context, | 20 [](const mojo::ConnectionContext& connection_context, |
| 21 mojo::InterfaceRequest<mojo::Clipboard> clipboard_request) { | 21 mojo::InterfaceRequest<mojo::Clipboard> clipboard_request) { |
| 22 // TODO(erg): Write native implementations of the clipboard. For now, | 22 // TODO(erg): Write native implementations of the clipboard. For now, |
| 23 // we just build a clipboard which doesn't interact with the system. | 23 // we just build a clipboard which doesn't interact with the system. |
| 24 new clipboard::ClipboardStandaloneImpl(clipboard_request.Pass()); | 24 new clipboard::ClipboardStandaloneImpl(clipboard_request.Pass()); |
| 25 }); | 25 }); |
| 26 return true; | 26 return true; |
| 27 } | 27 } |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 MojoResult MojoMain(MojoHandle application_request) { | 30 MojoResult MojoMain(MojoHandle application_request) { |
| 31 mojo::ApplicationRunnerChromium runner(new Delegate); | 31 mojo::ApplicationRunnerChromium runner(new Delegate); |
| 32 return runner.Run(application_request); | 32 return runner.Run(application_request); |
| 33 } | 33 } |
| OLD | NEW |