| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/shell/public/cpp/interface_registry.h" | 5 #include "mojo/shell/public/cpp/interface_registry.h" |
| 6 | 6 |
| 7 #include "mojo/shell/public/cpp/connection.h" | 7 #include "mojo/shell/public/cpp/connection.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bool InterfaceRegistry::SetInterfaceBinderForName( | 44 bool InterfaceRegistry::SetInterfaceBinderForName( |
| 45 InterfaceBinder* binder, | 45 InterfaceBinder* binder, |
| 46 const std::string& interface_name) { | 46 const std::string& interface_name) { |
| 47 if (!connection_ || | 47 if (!connection_ || |
| 48 (connection_ && connection_->AllowsInterface(interface_name))) { | 48 (connection_ && connection_->AllowsInterface(interface_name))) { |
| 49 RemoveInterfaceBinderForName(interface_name); | 49 RemoveInterfaceBinderForName(interface_name); |
| 50 name_to_binder_[interface_name] = binder; | 50 name_to_binder_[interface_name] = binder; |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 LOG(WARNING) << "Connection CapabilityFilter prevented binding to interface: " | 53 LOG(WARNING) << "Connection CapabilityFilter prevented binding to interface: " |
| 54 << interface_name << " connection_url:" | 54 << interface_name << " connection_name:" |
| 55 << connection_->GetConnectionURL() << " remote_url:" | 55 << connection_->GetConnectionName() << " remote_name:" |
| 56 << connection_->GetRemoteApplicationURL(); | 56 << connection_->GetRemoteApplicationName(); |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void InterfaceRegistry::RemoveInterfaceBinderForName( | 60 void InterfaceRegistry::RemoveInterfaceBinderForName( |
| 61 const std::string& interface_name) { | 61 const std::string& interface_name) { |
| 62 NameToInterfaceBinderMap::iterator it = name_to_binder_.find(interface_name); | 62 NameToInterfaceBinderMap::iterator it = name_to_binder_.find(interface_name); |
| 63 if (it == name_to_binder_.end()) | 63 if (it == name_to_binder_.end()) |
| 64 return; | 64 return; |
| 65 delete it->second; | 65 delete it->second; |
| 66 name_to_binder_.erase(it); | 66 name_to_binder_.erase(it); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace mojo | 69 } // namespace mojo |
| OLD | NEW |