| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MOJO_SHELL_CONNECT_UTIL_H_ | 5 #ifndef MOJO_SHELL_CONNECT_UTIL_H_ |
| 6 #define MOJO_SHELL_CONNECT_UTIL_H_ | 6 #define MOJO_SHELL_CONNECT_UTIL_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 11 #include "mojo/public/cpp/system/handle.h" | 11 #include "mojo/public/cpp/system/handle.h" |
| 12 #include "mojo/shell/identity.h" | 12 #include "mojo/shell/identity.h" |
| 13 #include "mojo/shell/public/interfaces/shell.mojom.h" |
| 13 | 14 |
| 14 class GURL; | 15 class GURL; |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 namespace shell { | 18 namespace shell { |
| 18 | 19 |
| 19 class ApplicationManager; | 20 class ApplicationManager; |
| 20 | 21 |
| 21 ScopedMessagePipeHandle ConnectToInterfaceByName( | 22 ScopedMessagePipeHandle ConnectToInterfaceByName( |
| 22 ApplicationManager* application_manager, | 23 ApplicationManager* application_manager, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 37 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); | 38 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 template <typename Interface> | 41 template <typename Interface> |
| 41 inline void ConnectToInterface(ApplicationManager* application_manager, | 42 inline void ConnectToInterface(ApplicationManager* application_manager, |
| 42 const Identity& source, | 43 const Identity& source, |
| 43 const GURL& application_url, | 44 const GURL& application_url, |
| 44 InterfacePtr<Interface>* ptr) { | 45 InterfacePtr<Interface>* ptr) { |
| 45 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName( | 46 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName( |
| 46 application_manager, source, | 47 application_manager, source, |
| 47 Identity(application_url, std::string(), GetPermissiveCapabilityFilter()), | 48 Identity(application_url, std::string(), mojom::Shell::kUserInherit, |
| 49 GetPermissiveCapabilityFilter()), |
| 48 Interface::Name_); | 50 Interface::Name_); |
| 49 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); | 51 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); |
| 50 } | 52 } |
| 51 | 53 |
| 52 } // namespace shell | 54 } // namespace shell |
| 53 } // namespace mojo | 55 } // namespace mojo |
| 54 | 56 |
| 55 | 57 |
| 56 #endif // MOJO_SHELL_CONNECT_UTIL_H_ | 58 #endif // MOJO_SHELL_CONNECT_UTIL_H_ |
| OLD | NEW |