diff options
author | erg <erg@chromium.org> | 2015-05-01 11:25:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 18:27:25 +0000 |
commit | 2cf387a31df4df41581982d28d964eb9e1607496 (patch) | |
tree | 99313498115762cc500724840a8c3317b707eb53 /components/clipboard/main.cc | |
parent | 7256234c44027dc75dae1fbe31c9faeaee5aa376 (diff) | |
download | chromium_src-2cf387a31df4df41581982d28d964eb9e1607496.zip chromium_src-2cf387a31df4df41581982d28d964eb9e1607496.tar.gz chromium_src-2cf387a31df4df41581982d28d964eb9e1607496.tar.bz2 |
mojo: Use ContentHandlers to bundle multiple Applications into a module.
The previous way of implementing core_services worked by having a
ServiceProvider as the external interface. This fell down because the
boundary between Applications in mojo is meaningful and is used in the
ViewManager and the WindowManager to restrict access to some services.
The (possibly misnamed) ContentHandler interface, on the other hand,
looks like a possible avenue of attack. ContentHandler's one method
starts new Applications. So mojo:core_services should be a
ContentHandler instead of a ServiceProvider and will spawn an
Application for each internal service.
This currently hard codes the mapping in context.cc, but eventually, we
should do something more intelligent for the packaging. This patch also
doesn't handle spawning new applications on new threads as we don't have
multiple applications yet.
BUG=477435
Review URL: https://codereview.chromium.org/1115363002
Cr-Commit-Position: refs/heads/master@{#327947}
Diffstat (limited to 'components/clipboard/main.cc')
-rw-r--r-- | components/clipboard/main.cc | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/components/clipboard/main.cc b/components/clipboard/main.cc index 75667d1..85f942a 100644 --- a/components/clipboard/main.cc +++ b/components/clipboard/main.cc @@ -2,36 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/clipboard/clipboard_standalone_impl.h" +#include "components/clipboard/clipboard_application_delegate.h" #include "mojo/application/application_runner_chromium.h" #include "third_party/mojo/src/mojo/public/c/system/main.h" -#include "third_party/mojo/src/mojo/public/cpp/application/application_connection.h" -#include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.h" -#include "third_party/mojo/src/mojo/public/cpp/application/interface_factory.h" - -class Delegate : public mojo::ApplicationDelegate, - public mojo::InterfaceFactory<mojo::Clipboard> { - public: - Delegate() {} - ~Delegate() override {} - - // mojo::ApplicationDelegate implementation. - bool ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) override { - connection->AddService(this); - return true; - } - - // mojo::InterfaceFactory<mojo::Clipboard> implementation. - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::Clipboard> request) override { - // TODO(erg): Write native implementations of the clipboard. For now, we - // just build a clipboard which doesn't interact with the system. - new clipboard::ClipboardStandaloneImpl(request.Pass()); - } -}; MojoResult MojoMain(MojoHandle shell_handle) { - mojo::ApplicationRunnerChromium runner(new Delegate); + mojo::ApplicationRunnerChromium runner( + new clipboard::ClipboardApplicationDelegate); return runner.Run(shell_handle); } |