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

Side by Side Diff: mojo/shell/public/cpp/shell.h

Issue 1681813002: Rename Connection::AddService/ConnectToService to Connection::AddInterface/GetInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_binder
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
OLDNEW
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/app_lifetime_helper.h" 8 #include "mojo/shell/public/cpp/app_lifetime_helper.h"
9 #include "mojo/shell/public/cpp/connection.h" 9 #include "mojo/shell/public/cpp/connection.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
43 // connection if the connection is permitted by this application's delegate, 43 // connection if the connection is permitted by this application's delegate,
44 // or nullptr otherwise. Caller takes ownership. 44 // or nullptr otherwise. Caller takes ownership.
45 virtual scoped_ptr<Connection> Connect(const std::string& url) = 0; 45 virtual scoped_ptr<Connection> Connect(const std::string& url) = 0;
46 virtual scoped_ptr<Connection> Connect(ConnectParams* params) = 0; 46 virtual scoped_ptr<Connection> Connect(ConnectParams* params) = 0;
47 47
48 // Connect to application identified by |request->url| and connect to the 48 // Connect to application identified by |request->url| and connect to the
49 // service implementation of the interface identified by |Interface|. 49 // service implementation of the interface identified by |Interface|.
50 template <typename Interface> 50 template <typename Interface>
51 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) { 51 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) {
52 scoped_ptr<Connection> connection = Connect(params); 52 scoped_ptr<Connection> connection = Connect(params);
53 if (!connection.get()) 53 if (connection)
54 return; 54 connection->GetInterface(ptr);
55 connection->ConnectToService(ptr);
56 } 55 }
57 template <typename Interface> 56 template <typename Interface>
58 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) { 57 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) {
59 ConnectParams params(url); 58 ConnectParams params(url);
60 params.set_filter(CreatePermissiveCapabilityFilter()); 59 params.set_filter(CreatePermissiveCapabilityFilter());
61 return ConnectToService(&params, ptr); 60 return ConnectToService(&params, ptr);
62 } 61 }
63 62
64 // Initiate shutdown of this application. This may involve a round trip to the 63 // Initiate shutdown of this application. This may involve a round trip to the
65 // Shell to ensure there are no inbound service requests. 64 // Shell to ensure there are no inbound service requests.
66 virtual void Quit() = 0; 65 virtual void Quit() = 0;
67 66
68 // Create an object that can be used to refcount the lifetime of the 67 // Create an object that can be used to refcount the lifetime of the
69 // application. The returned object may be cloned, and when the refcount falls 68 // application. The returned object may be cloned, and when the refcount falls
70 // to zero Quit() is called. 69 // to zero Quit() is called.
71 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0; 70 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0;
72 }; 71 };
73 72
74 } // namespace mojo 73 } // namespace mojo
75 74
76 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_ 75 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/connection_impl.cc ('k') | mojo/shell/runner/child/native_apptest_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698