| Index: content/public/common/associated_interface_provider.h
|
| diff --git a/content/public/common/associated_interface_provider.h b/content/public/common/associated_interface_provider.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..17fbab8513eb9d52fdedd702e3af730650d40642
|
| --- /dev/null
|
| +++ b/content/public/common/associated_interface_provider.h
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2016 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 CONTENT_PUBLIC_COMMON_ASSOCIATED_INTERFACE_PROVIDER_H_
|
| +#define CONTENT_PUBLIC_COMMON_ASSOCIATED_INTERFACE_PROVIDER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
|
| +#include "mojo/public/cpp/bindings/associated_interface_request.h"
|
| +#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
|
| +
|
| +namespace mojo {
|
| +class AssociatedGroup;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +// A helper interface for connecting to remote Channel-associated interfaces.
|
| +class AssociatedInterfaceProvider {
|
| + public:
|
| + virtual ~AssociatedInterfaceProvider() {}
|
| +
|
| + // Passes an associated endpoint handle to the remote end to be bound to a
|
| + // Channel-associated interface named |name|.
|
| + virtual void GetInterface(const std::string& name,
|
| + mojo::ScopedInterfaceEndpointHandle handle) = 0;
|
| +
|
| + // Returns an AssociatedGroup for the provider. This may be used to create
|
| + // new associated endpoints for use with Channel-associated interfaces.
|
| + virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0;
|
| +
|
| + // Templated helper for GetInterface().
|
| + template <typename Interface>
|
| + void GetInterface(mojo::AssociatedInterfacePtr<Interface>* proxy) {
|
| + mojo::AssociatedInterfaceRequest<Interface> request =
|
| + mojo::GetProxy(proxy, GetAssociatedGroup());
|
| + GetInterface(Interface::Name_, request.PassHandle());
|
| + }
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_PUBLIC_COMMON_ASSOCIATED_INTERFACE_PROVIDER_H_
|
|
|