Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: mojo/shell/connect_util.h

Issue 1743473002: Change Mojo URLs to structured names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@18collapse
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/connect_params.h ('k') | mojo/shell/identity.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9
10 #include "mojo/public/cpp/bindings/interface_ptr.h" 8 #include "mojo/public/cpp/bindings/interface_ptr.h"
11 #include "mojo/public/cpp/system/handle.h" 9 #include "mojo/public/cpp/system/handle.h"
12 #include "mojo/shell/identity.h" 10 #include "mojo/shell/identity.h"
13 #include "mojo/shell/public/interfaces/shell.mojom.h" 11 #include "mojo/shell/public/interfaces/shell.mojom.h"
14 12
15 class GURL;
16
17 namespace mojo { 13 namespace mojo {
18 namespace shell { 14 namespace shell {
19 15
20 class ApplicationManager; 16 class ApplicationManager;
21 17
22 ScopedMessagePipeHandle ConnectToInterfaceByName( 18 ScopedMessagePipeHandle ConnectToInterfaceByName(
23 ApplicationManager* application_manager, 19 ApplicationManager* application_manager,
24 const Identity& source, 20 const Identity& source,
25 const Identity& target, 21 const Identity& target,
26 const std::string& interface_name); 22 const std::string& interface_name);
27 23
28 // Must only be used by shell internals and test code as it does not forward 24 // Must only be used by shell internals and test code as it does not forward
29 // capability filters. Runs |application_url| with a permissive capability 25 // capability filters. Runs |application_name| with a permissive capability
30 // filter. 26 // filter.
31 template <typename Interface> 27 template <typename Interface>
32 inline void ConnectToInterface(ApplicationManager* application_manager, 28 inline void ConnectToInterface(ApplicationManager* application_manager,
33 const Identity& source, 29 const Identity& source,
34 const Identity& target, 30 const Identity& target,
35 InterfacePtr<Interface>* ptr) { 31 InterfacePtr<Interface>* ptr) {
36 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName( 32 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName(
37 application_manager, source, target, Interface::Name_); 33 application_manager, source, target, Interface::Name_);
38 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); 34 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u));
39 } 35 }
40 36
41 template <typename Interface> 37 template <typename Interface>
42 inline void ConnectToInterface(ApplicationManager* application_manager, 38 inline void ConnectToInterface(ApplicationManager* application_manager,
43 const Identity& source, 39 const Identity& source,
44 const GURL& application_url, 40 const std::string& application_name,
45 InterfacePtr<Interface>* ptr) { 41 InterfacePtr<Interface>* ptr) {
46 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName( 42 ScopedMessagePipeHandle service_handle = ConnectToInterfaceByName(
47 application_manager, source, 43 application_manager, source,
48 Identity(application_url, std::string(), mojom::Connector::kUserInherit), 44 Identity(application_name, std::string(), mojom::Connector::kUserInherit),
49 Interface::Name_); 45 Interface::Name_);
50 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u)); 46 ptr->Bind(InterfacePtrInfo<Interface>(std::move(service_handle), 0u));
51 } 47 }
52 48
53 } // namespace shell 49 } // namespace shell
54 } // namespace mojo 50 } // namespace mojo
55 51
56 52
57 #endif // MOJO_SHELL_CONNECT_UTIL_H_ 53 #endif // MOJO_SHELL_CONNECT_UTIL_H_
OLDNEW
« no previous file with comments | « mojo/shell/connect_params.h ('k') | mojo/shell/identity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698