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

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

Issue 1660403003: Mojo C++ bindings: Rename InterfaceInfoPtr -> InterfaceHandle (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: using {{InterfaceName}}Handle = InterfaceHandle<{{InterfaceName}}> 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 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_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_ 5 #ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_
6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_ 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "mojo/public/cpp/application/lib/interface_factory_connector.h" 10 #include "mojo/public/cpp/application/lib/interface_factory_connector.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Interface::Name_); 47 Interface::Name_);
48 } 48 }
49 49
50 // Binds |ptr| to an implemention of Interface in the remote application. 50 // Binds |ptr| to an implemention of Interface in the remote application.
51 // |ptr| can immediately be used to start sending requests to the remote 51 // |ptr| can immediately be used to start sending requests to the remote
52 // service. 52 // service.
53 template <typename Interface> 53 template <typename Interface>
54 void ConnectToService(InterfacePtr<Interface>* ptr) { 54 void ConnectToService(InterfacePtr<Interface>* ptr) {
55 if (ServiceProvider* sp = GetServiceProvider()) { 55 if (ServiceProvider* sp = GetServiceProvider()) {
56 MessagePipe pipe; 56 MessagePipe pipe;
57 ptr->Bind(InterfacePtrInfo<Interface>(pipe.handle0.Pass(), 0u)); 57 ptr->Bind(InterfaceHandle<Interface>(pipe.handle0.Pass(), 0u));
58 sp->ConnectToService(Interface::Name_, pipe.handle1.Pass()); 58 sp->ConnectToService(Interface::Name_, pipe.handle1.Pass());
59 } 59 }
60 } 60 }
61 61
62 // Returns the URL that was used by the source application to establish a 62 // Returns the URL that was used by the source application to establish a
63 // connection to the destination application. 63 // connection to the destination application.
64 // 64 //
65 // When ApplicationConnection is representing an incoming connection this can 65 // When ApplicationConnection is representing an incoming connection this can
66 // be different than the URL the application was initially loaded from, if the 66 // be different than the URL the application was initially loaded from, if the
67 // application handles multiple URLs. Note that this is the URL after all 67 // application handles multiple URLs. Note that this is the URL after all
(...skipping 12 matching lines...) Expand all
80 virtual ServiceProvider* GetServiceProvider() = 0; 80 virtual ServiceProvider* GetServiceProvider() = 0;
81 81
82 private: 82 private:
83 virtual void SetServiceConnectorForName(ServiceConnector* service_connector, 83 virtual void SetServiceConnectorForName(ServiceConnector* service_connector,
84 const std::string& name) = 0; 84 const std::string& name) = 0;
85 }; 85 };
86 86
87 } // namespace mojo 87 } // namespace mojo
88 88
89 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_ 89 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698