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 #ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_H_ |
7 | 7 |
8 #include "mojo/shell/public/cpp/connection.h" | 8 #include "mojo/shell/public/cpp/connection.h" |
9 #include "mojo/shell/public/cpp/connector.h" | 9 #include "mojo/shell/public/cpp/connector.h" |
10 #include "mojo/shell/public/interfaces/shell.mojom.h" | 10 #include "mojo/shell/public/interfaces/shell.mojom.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void ConnectToInterface(Connector::ConnectParams* params, | 43 void ConnectToInterface(Connector::ConnectParams* params, |
44 InterfacePtr<Interface>* ptr) { | 44 InterfacePtr<Interface>* ptr) { |
45 scoped_ptr<Connection> connection = Connect(params); | 45 scoped_ptr<Connection> connection = Connect(params); |
46 if (connection) | 46 if (connection) |
47 connection->GetInterface(ptr); | 47 connection->GetInterface(ptr); |
48 } | 48 } |
49 template <typename Interface> | 49 template <typename Interface> |
50 void ConnectToInterface(const std::string& url, | 50 void ConnectToInterface(const std::string& url, |
51 InterfacePtr<Interface>* ptr) { | 51 InterfacePtr<Interface>* ptr) { |
52 Connector::ConnectParams params(url); | 52 Connector::ConnectParams params(url); |
53 params.set_filter(CreatePermissiveCapabilityFilter()); | |
54 return ConnectToInterface(¶ms, ptr); | 53 return ConnectToInterface(¶ms, ptr); |
55 } | 54 } |
56 | 55 |
57 // Returns a clone of the ShellConnection's Connector that can be passed to | 56 // Returns a clone of the ShellConnection's Connector that can be passed to |
58 // other threads. | 57 // other threads. |
59 virtual scoped_ptr<Connector> CloneConnector() const = 0; | 58 virtual scoped_ptr<Connector> CloneConnector() const = 0; |
60 | 59 |
61 // Initiate shutdown of this application. This may involve a round trip to the | 60 // Initiate shutdown of this application. This may involve a round trip to the |
62 // Shell to ensure there are no inbound service requests. | 61 // Shell to ensure there are no inbound service requests. |
63 virtual void Quit() = 0; | 62 virtual void Quit() = 0; |
64 | 63 |
65 // Create an object that can be used to refcount the lifetime of the | 64 // Create an object that can be used to refcount the lifetime of the |
66 // application. The returned object may be cloned, and when the refcount falls | 65 // application. The returned object may be cloned, and when the refcount falls |
67 // to zero Quit() is called. | 66 // to zero Quit() is called. |
68 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0; | 67 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0; |
69 }; | 68 }; |
70 | 69 |
71 } // namespace mojo | 70 } // namespace mojo |
72 | 71 |
73 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_ | 72 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_ |
OLD | NEW |