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

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

Issue 1687693002: Rename ConnectToService to ConnectToInterface() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sp2
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/capability_filter_test.cc ('k') | mojo/shell/runner/child/native_apptest.cc » ('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 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 30 matching lines...) Expand all
41 41
42 // Requests a new connection to an application. Returns a pointer to the 42 // Requests a new connection to an application. Returns a pointer to the
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 ConnectToInterface(ConnectParams* params, InterfacePtr<Interface>* ptr) {
52 scoped_ptr<Connection> connection = Connect(params); 52 scoped_ptr<Connection> connection = Connect(params);
53 if (connection) 53 if (connection)
54 connection->GetInterface(ptr); 54 connection->GetInterface(ptr);
55 } 55 }
56 template <typename Interface> 56 template <typename Interface>
57 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) { 57 void ConnectToInterface(const std::string& url,
58 InterfacePtr<Interface>* ptr) {
58 ConnectParams params(url); 59 ConnectParams params(url);
59 params.set_filter(CreatePermissiveCapabilityFilter()); 60 params.set_filter(CreatePermissiveCapabilityFilter());
60 return ConnectToService(&params, ptr); 61 return ConnectToInterface(&params, ptr);
61 } 62 }
62 63
63 // Initiate shutdown of this application. This may involve a round trip to the 64 // Initiate shutdown of this application. This may involve a round trip to the
64 // Shell to ensure there are no inbound service requests. 65 // Shell to ensure there are no inbound service requests.
65 virtual void Quit() = 0; 66 virtual void Quit() = 0;
66 67
67 // Create an object that can be used to refcount the lifetime of the 68 // Create an object that can be used to refcount the lifetime of the
68 // application. The returned object may be cloned, and when the refcount falls 69 // application. The returned object may be cloned, and when the refcount falls
69 // to zero Quit() is called. 70 // to zero Quit() is called.
70 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0; 71 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0;
71 }; 72 };
72 73
73 } // namespace mojo 74 } // namespace mojo
74 75
75 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_ 76 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_
OLDNEW
« no previous file with comments | « mojo/shell/capability_filter_test.cc ('k') | mojo/shell/runner/child/native_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698