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

Side by Side Diff: mojo/application/public/cpp/application_impl.h

Issue 1474563002: Make CapabilityFilter non-nullable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "mojo/application/public/cpp/app_lifetime_helper.h" 13 #include "mojo/application/public/cpp/app_lifetime_helper.h"
14 #include "mojo/application/public/cpp/application_connection.h" 14 #include "mojo/application/public/cpp/application_connection.h"
15 #include "mojo/application/public/cpp/application_delegate.h" 15 #include "mojo/application/public/cpp/application_delegate.h"
16 #include "mojo/application/public/cpp/lib/service_registry.h" 16 #include "mojo/application/public/cpp/lib/service_registry.h"
17 #include "mojo/application/public/interfaces/application.mojom.h" 17 #include "mojo/application/public/interfaces/application.mojom.h"
18 #include "mojo/application/public/interfaces/shell.mojom.h" 18 #include "mojo/application/public/interfaces/shell.mojom.h"
19 #include "mojo/public/cpp/bindings/binding.h" 19 #include "mojo/public/cpp/bindings/binding.h"
20 #include "mojo/public/cpp/bindings/callback.h" 20 #include "mojo/public/cpp/bindings/callback.h"
21 #include "mojo/public/cpp/system/core.h" 21 #include "mojo/public/cpp/system/core.h"
22 22
23 namespace mojo { 23 namespace mojo {
24 24
25 CapabilityFilterPtr CreatePermissiveCapabilityFilter();
26
25 // TODO(beng): This comment is hilariously out of date. 27 // TODO(beng): This comment is hilariously out of date.
26 // Utility class for communicating with the Shell, and providing Services 28 // Utility class for communicating with the Shell, and providing Services
27 // to clients. 29 // to clients.
28 // 30 //
29 // To use define a class that implements your specific server api, e.g. FooImpl 31 // To use define a class that implements your specific server api, e.g. FooImpl
30 // to implement a service named Foo. 32 // to implement a service named Foo.
31 // That class must subclass an InterfaceImpl specialization. 33 // That class must subclass an InterfaceImpl specialization.
32 // 34 //
33 // If there is context that is to be shared amongst all instances, define a 35 // If there is context that is to be shared amongst all instances, define a
34 // constructor with that class as its only argument, otherwise define an empty 36 // constructor with that class as its only argument, otherwise define an empty
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 template <typename Interface> 126 template <typename Interface>
125 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) { 127 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) {
126 scoped_ptr<ApplicationConnection> connection = ConnectToApplication(params); 128 scoped_ptr<ApplicationConnection> connection = ConnectToApplication(params);
127 if (!connection.get()) 129 if (!connection.get())
128 return; 130 return;
129 connection->ConnectToService(ptr); 131 connection->ConnectToService(ptr);
130 } 132 }
131 template <typename Interface> 133 template <typename Interface>
132 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) { 134 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) {
133 ConnectParams params(url); 135 ConnectParams params(url);
136 params.set_filter(CreatePermissiveCapabilityFilter());
134 return ConnectToService(&params, ptr); 137 return ConnectToService(&params, ptr);
135 } 138 }
136 139
137 // Block the calling thread until the Initialize() method is called by the 140 // Block the calling thread until the Initialize() method is called by the
138 // shell. 141 // shell.
139 void WaitForInitialize(); 142 void WaitForInitialize();
140 143
141 // Initiate shutdown of this application. This may involve a round trip to the 144 // Initiate shutdown of this application. This may involve a round trip to the
142 // Shell to ensure there are no inbound service requests. 145 // Shell to ensure there are no inbound service requests.
143 void Quit(); 146 void Quit();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 AppLifetimeHelper app_lifetime_helper_; 178 AppLifetimeHelper app_lifetime_helper_;
176 bool quit_requested_; 179 bool quit_requested_;
177 base::WeakPtrFactory<ApplicationImpl> weak_factory_; 180 base::WeakPtrFactory<ApplicationImpl> weak_factory_;
178 181
179 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 182 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
180 }; 183 };
181 184
182 } // namespace mojo 185 } // namespace mojo
183 186
184 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 187 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
OLDNEW
« no previous file with comments | « content/test/data/web_ui_mojo_shell_test.js ('k') | mojo/application/public/cpp/lib/application_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698