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

Unified Diff: trunk/src/content/public/common/service_registry.h

Issue 352013002: Revert 279557 "Support exposing Mojo services between render fra..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/content/public/common/service_registry.h
===================================================================
--- trunk/src/content/public/common/service_registry.h (revision 279559)
+++ trunk/src/content/public/common/service_registry.h (working copy)
@@ -1,73 +0,0 @@
-// Copyright 2014 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_SERVICE_REGISTRY_H_
-#define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
-
-#include <string>
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/strings/string_piece.h"
-#include "content/common/content_export.h"
-#include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace content {
-
-// A ServiceRegistry exposes local services that have been added using
-// AddService to a paired remote ServiceRegistry and provides local access to
-// services exposed by the remote ServiceRegistry through GetInterface.
-class CONTENT_EXPORT ServiceRegistry {
- public:
- virtual ~ServiceRegistry() {}
-
- // Make the service created by |service_factory| available to the remote
- // InterfaceProvider. In response to each request for a service,
- // |service_factory| will be run with an InterfaceRequest<Interface>
- // representing that request.
- template <typename Interface>
- void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)>
- service_factory) {
- AddService(Interface::Name_,
- base::Bind(&ServiceRegistry::ForwardToServiceFactory<Interface>,
- service_factory));
- }
- virtual void AddService(
- const std::string& service_name,
- const base::Callback<void(mojo::ScopedMessagePipeHandle)>
- service_factory) = 0;
-
- // Remove future access to the service implementing Interface. Existing
- // connections to the service are unaffected.
- template <typename Interface>
- void RemoveService() {
- RemoveService(Interface::Name_);
- }
- virtual void RemoveService(const std::string& service_name) = 0;
-
- // Connect to an interface provided by the remote interface provider.
- template <typename Interface>
- void GetRemoteInterface(mojo::InterfacePtr<Interface>* ptr) {
- mojo::MessagePipe pipe;
- ptr->Bind(pipe.handle0.Pass());
- GetRemoteInterface(Interface::Name_, pipe.handle1.Pass());
- }
- virtual void GetRemoteInterface(const base::StringPiece& name,
- mojo::ScopedMessagePipeHandle handle) = 0;
-
- private:
- template <typename Interface>
- static void ForwardToServiceFactory(
- const base::Callback<void(mojo::InterfaceRequest<Interface>)>
- service_factory,
- mojo::ScopedMessagePipeHandle handle) {
- service_factory.Run(mojo::MakeRequest<Interface>(handle.Pass()));
- }
-};
-
-} // namespace content
-
-#endif // CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_
« no previous file with comments | « trunk/src/content/public/browser/render_view_host.h ('k') | trunk/src/content/public/renderer/render_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698