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/clipboard_application_delegate.h | |
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/clipboard_application_delegate.h')
-rw-r--r-- | components/clipboard/clipboard_application_delegate.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/components/clipboard/clipboard_application_delegate.h b/components/clipboard/clipboard_application_delegate.h new file mode 100644 index 0000000..fcbb415 --- /dev/null +++ b/components/clipboard/clipboard_application_delegate.h @@ -0,0 +1,40 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_CLIPBOARD_CLIBPOARD_APPLICATION_DELEGATE_H_ +#define COMPONENTS_CLIPBOARD_CLIBPOARD_APPLICATION_DELEGATE_H_ + +#include "base/macros.h" +#include "components/clipboard/public/interfaces/clipboard.mojom.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" + +namespace mojo { +class ApplicationConnection; +} + +namespace clipboard { + +class ClipboardApplicationDelegate + : public mojo::ApplicationDelegate, + public mojo::InterfaceFactory<mojo::Clipboard> { + public: + ClipboardApplicationDelegate(); + ~ClipboardApplicationDelegate() override; + + // mojo::ApplicationDelegate implementation. + bool ConfigureIncomingConnection( + mojo::ApplicationConnection* connection) override; + + // mojo::InterfaceFactory<mojo::Clipboard> implementation. + void Create(mojo::ApplicationConnection* connection, + mojo::InterfaceRequest<mojo::Clipboard> request) override; + + private: + DISALLOW_COPY_AND_ASSIGN(ClipboardApplicationDelegate); +}; + +} // namespace clipboard + +#endif // COMPONENTS_CLIPBOARD_CLIBPOARD_APPLICATION_DELEGATE_H_ |