| 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 "services/shell/public/cpp/interface_registry.h" | 5 #include "services/shell/public/cpp/interface_registry.h" |
| 6 | 6 |
| 7 #include "services/shell/public/cpp/connection.h" | 7 #include "services/shell/public/cpp/connection.h" |
| 8 | 8 |
| 9 namespace shell { | 9 namespace shell { |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 base::WeakPtr<InterfaceRegistry> InterfaceRegistry::GetWeakPtr() { | 32 base::WeakPtr<InterfaceRegistry> InterfaceRegistry::GetWeakPtr() { |
| 33 return weak_factory_.GetWeakPtr(); | 33 return weak_factory_.GetWeakPtr(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool InterfaceRegistry::AddInterface( | 36 bool InterfaceRegistry::AddInterface( |
| 37 const std::string& name, | 37 const std::string& name, |
| 38 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, | 38 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
| 40 return SetInterfaceBinderForName( | 40 return SetInterfaceBinderForName( |
| 41 base::WrapUnique( | 41 base::MakeUnique<internal::GenericCallbackBinder>(callback, task_runner), |
| 42 new internal::GenericCallbackBinder(callback, task_runner)), | |
| 43 name); | 42 name); |
| 44 } | 43 } |
| 45 | 44 |
| 46 void InterfaceRegistry::RemoveInterface(const std::string& name) { | 45 void InterfaceRegistry::RemoveInterface(const std::string& name) { |
| 47 auto it = name_to_binder_.find(name); | 46 auto it = name_to_binder_.find(name); |
| 48 if (it != name_to_binder_.end()) | 47 if (it != name_to_binder_.end()) |
| 49 name_to_binder_.erase(it); | 48 name_to_binder_.erase(it); |
| 50 } | 49 } |
| 51 | 50 |
| 52 void InterfaceRegistry::PauseBinding() { | 51 void InterfaceRegistry::PauseBinding() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return false; | 111 return false; |
| 113 } | 112 } |
| 114 | 113 |
| 115 bool InterfaceRegistry::CanBindRequestForInterface( | 114 bool InterfaceRegistry::CanBindRequestForInterface( |
| 116 const std::string& interface_name) const { | 115 const std::string& interface_name) const { |
| 117 return allow_all_interfaces_ || | 116 return allow_all_interfaces_ || |
| 118 capability_request_.interfaces.count(interface_name); | 117 capability_request_.interfaces.count(interface_name); |
| 119 } | 118 } |
| 120 | 119 |
| 121 } // namespace shell | 120 } // namespace shell |
| OLD | NEW |