OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/common/associated_interface_registry_impl.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/logging.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 AssociatedInterfaceRegistryImpl::AssociatedInterfaceRegistryImpl() {} |
| 14 |
| 15 AssociatedInterfaceRegistryImpl::~AssociatedInterfaceRegistryImpl() {} |
| 16 |
| 17 void AssociatedInterfaceRegistryImpl::BindRequest( |
| 18 const std::string& interface_name, |
| 19 mojo::ScopedInterfaceEndpointHandle handle) { |
| 20 auto it = interfaces_.find(interface_name); |
| 21 if (it == interfaces_.end()) |
| 22 return; |
| 23 it->second.Run(std::move(handle)); |
| 24 } |
| 25 |
| 26 void AssociatedInterfaceRegistryImpl::AddInterface(const std::string& name, |
| 27 const Binder& binder) { |
| 28 auto result = interfaces_.insert(std::make_pair(name, binder)); |
| 29 DCHECK(result.second); |
| 30 } |
| 31 |
| 32 void AssociatedInterfaceRegistryImpl::RemoveInterface(const std::string& name) { |
| 33 auto it = interfaces_.find(name); |
| 34 DCHECK(it != interfaces_.end()); |
| 35 interfaces_.erase(it); |
| 36 } |
| 37 |
| 38 } // namespace content |
OLD | NEW |