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

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

Issue 1977033002: Make ServiceRegistry (which implements) ApplicationConnection just wrap a ServiceProviderImpl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | mojo/public/cpp/application/lib/service_provider_impl.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 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"
11 #include "mojo/public/cpp/application/service_provider_impl.h"
11 #include "mojo/public/interfaces/application/service_provider.mojom.h" 12 #include "mojo/public/interfaces/application/service_provider.mojom.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 15
15 struct ConnectionContext; 16 struct ConnectionContext;
16 class ServiceConnector; 17 class ServiceConnector;
17 18
18 // Represents a connection to another application. An instance of this class is 19 // Represents a connection to another application. An instance of this class is
19 // passed to ApplicationDelegate's ConfigureIncomingConnection() method each 20 // passed to ApplicationDelegate's ConfigureIncomingConnection() method each
20 // time a connection is made to this app, and is returned by the 21 // time a connection is made to this app, and is returned by the
(...skipping 22 matching lines...) Expand all
43 44
44 // Makes Interface available as a service to the remote application. 45 // Makes Interface available as a service to the remote application.
45 // |factory| will create implementations of Interface on demand. 46 // |factory| will create implementations of Interface on demand.
46 template <typename Interface> 47 template <typename Interface>
47 void AddService(InterfaceFactory<Interface>* factory) { 48 void AddService(InterfaceFactory<Interface>* factory) {
48 SetServiceConnectorForName( 49 SetServiceConnectorForName(
49 new internal::InterfaceFactoryConnector<Interface>(factory), 50 new internal::InterfaceFactoryConnector<Interface>(factory),
50 Interface::Name_); 51 Interface::Name_);
51 } 52 }
52 53
54 virtual ServiceProviderImpl& GetServiceProviderImpl() = 0;
55
53 virtual const ConnectionContext& GetConnectionContext() const = 0; 56 virtual const ConnectionContext& GetConnectionContext() const = 0;
54 57
55 // Returns the URL that was used by the source application to establish a 58 // Returns the URL that was used by the source application to establish a
56 // connection to the destination application. 59 // connection to the destination application.
57 // 60 //
58 // When ApplicationConnection is representing an incoming connection this can 61 // When ApplicationConnection is representing an incoming connection this can
59 // be different than the URL the application was initially loaded from, if the 62 // be different than the URL the application was initially loaded from, if the
60 // application handles multiple URLs. Note that this is the URL after all 63 // application handles multiple URLs. Note that this is the URL after all
61 // URL rewriting and HTTP redirects have been performed. 64 // URL rewriting and HTTP redirects have been performed.
62 // 65 //
63 // When ApplicationConnection is representing and outgoing connection, this 66 // When ApplicationConnection is representing and outgoing connection, this
64 // will be the same as the value returned by GetRemoveApplicationURL(). 67 // will be the same as the value returned by GetRemoveApplicationURL().
65 virtual const std::string& GetConnectionURL() = 0; 68 virtual const std::string& GetConnectionURL() = 0;
66 69
67 // Returns the URL identifying the remote application on this connection. 70 // Returns the URL identifying the remote application on this connection.
68 virtual const std::string& GetRemoteApplicationURL() = 0; 71 virtual const std::string& GetRemoteApplicationURL() = 0;
69 72
70 private: 73 private:
71 virtual void SetServiceConnectorForName(ServiceConnector* service_connector, 74 virtual void SetServiceConnectorForName(ServiceConnector* service_connector,
72 const std::string& name) = 0; 75 const std::string& name) = 0;
73 }; 76 };
74 77
75 } // namespace mojo 78 } // namespace mojo
76 79
77 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_ 80 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/application/lib/service_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698