1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46

content / renderer / mojo / blink_interface_registry_impl.h [blame]

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_MOJO_BLINK_INTERFACE_REGISTRY_IMPL_H_
#define CONTENT_RENDERER_MOJO_BLINK_INTERFACE_REGISTRY_IMPL_H_

#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/platform/interface_registry.h"

namespace content {

class BlinkInterfaceRegistryImpl final : public blink::InterfaceRegistry {
 public:
  BlinkInterfaceRegistryImpl(
      base::WeakPtr<service_manager::BinderRegistry> interface_registry,
      base::WeakPtr<blink::AssociatedInterfaceRegistry>
          associated_interface_registry);

  BlinkInterfaceRegistryImpl(const BlinkInterfaceRegistryImpl&) = delete;
  BlinkInterfaceRegistryImpl& operator=(const BlinkInterfaceRegistryImpl&) =
      delete;

  ~BlinkInterfaceRegistryImpl();

  // blink::InterfaceRegistry override.
  void AddInterface(
      const char* name,
      const blink::InterfaceFactory& factory,
      scoped_refptr<base::SingleThreadTaskRunner> task_runner) override;
  void AddAssociatedInterface(
      const char* name,
      const blink::AssociatedInterfaceFactory& factory) override;

 private:
  const base::WeakPtr<service_manager::BinderRegistry> interface_registry_;
  const base::WeakPtr<blink::AssociatedInterfaceRegistry>
      associated_interface_registry_;
};

}  // namespace content

#endif  // CONTENT_RENDERER_MOJO_BLINK_INTERFACE_REGISTRY_IMPL_H_