| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void InterfaceRegistry::GetInterfaceNames( | 57 void InterfaceRegistry::GetInterfaceNames( |
| 58 std::set<std::string>* interface_names) { | 58 std::set<std::string>* interface_names) { |
| 59 DCHECK(interface_names); | 59 DCHECK(interface_names); |
| 60 for (auto& entry : name_to_binder_) | 60 for (auto& entry : name_to_binder_) |
| 61 interface_names->insert(entry.first); | 61 interface_names->insert(entry.first); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void InterfaceRegistry::SetConnectionLostClosure( |
| 65 const base::Closure& connection_lost_closure) { |
| 66 binding_.set_connection_error_handler(connection_lost_closure); |
| 67 } |
| 68 |
| 64 // mojom::InterfaceProvider: | 69 // mojom::InterfaceProvider: |
| 65 void InterfaceRegistry::GetInterface(const mojo::String& interface_name, | 70 void InterfaceRegistry::GetInterface(const mojo::String& interface_name, |
| 66 mojo::ScopedMessagePipeHandle handle) { | 71 mojo::ScopedMessagePipeHandle handle) { |
| 67 if (is_paused_) { | 72 if (is_paused_) { |
| 68 pending_interface_requests_.emplace(interface_name, std::move(handle)); | 73 pending_interface_requests_.emplace(interface_name, std::move(handle)); |
| 69 return; | 74 return; |
| 70 } | 75 } |
| 71 | 76 |
| 72 auto iter = name_to_binder_.find(interface_name); | 77 auto iter = name_to_binder_.find(interface_name); |
| 73 if (iter != name_to_binder_.end()) { | 78 if (iter != name_to_binder_.end()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 94 if (!connection_ || | 99 if (!connection_ || |
| 95 (connection_ && connection_->AllowsInterface(interface_name))) { | 100 (connection_ && connection_->AllowsInterface(interface_name))) { |
| 96 RemoveInterface(interface_name); | 101 RemoveInterface(interface_name); |
| 97 name_to_binder_[interface_name] = std::move(binder); | 102 name_to_binder_[interface_name] = std::move(binder); |
| 98 return true; | 103 return true; |
| 99 } | 104 } |
| 100 return false; | 105 return false; |
| 101 } | 106 } |
| 102 | 107 |
| 103 } // namespace shell | 108 } // namespace shell |
| OLD | NEW |