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

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

Issue 1977043002: ApplicationConnection devolution, part 1. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_service_registry_spimpl
Patch Set: rebased 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 | « examples/bank_app/bank.cc ('k') | mojo/public/cpp/application/lib/service_registry.h » ('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 <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "mojo/public/cpp/application/lib/interface_factory_connector.h" 11 #include "mojo/public/cpp/application/lib/interface_factory_connector.h"
11 #include "mojo/public/cpp/application/service_provider_impl.h" 12 #include "mojo/public/cpp/application/service_provider_impl.h"
12 #include "mojo/public/interfaces/application/service_provider.mojom.h" 13 #include "mojo/public/interfaces/application/service_provider.mojom.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 struct ConnectionContext; 17 struct ConnectionContext;
17 class ServiceConnector; 18 class ServiceConnector;
(...skipping 21 matching lines...) Expand all
39 // 40 //
40 // TODO(vtl): Don't get too attached to this class. I'm going to remove it. 41 // TODO(vtl): Don't get too attached to this class. I'm going to remove it.
41 class ApplicationConnection { 42 class ApplicationConnection {
42 public: 43 public:
43 virtual ~ApplicationConnection(); 44 virtual ~ApplicationConnection();
44 45
45 // Makes Interface available as a service to the remote application. 46 // Makes Interface available as a service to the remote application.
46 // |factory| will create implementations of Interface on demand. 47 // |factory| will create implementations of Interface on demand.
47 template <typename Interface> 48 template <typename Interface>
48 void AddService(InterfaceFactory<Interface>* factory) { 49 void AddService(InterfaceFactory<Interface>* factory) {
49 SetServiceConnectorForName( 50 GetServiceProviderImpl().AddServiceForName(
50 new internal::InterfaceFactoryConnector<Interface>(factory), 51 std::unique_ptr<ServiceConnector>(
52 new internal::InterfaceFactoryConnector<Interface>(factory)),
51 Interface::Name_); 53 Interface::Name_);
52 } 54 }
53 55
54 virtual ServiceProviderImpl& GetServiceProviderImpl() = 0; 56 virtual ServiceProviderImpl& GetServiceProviderImpl() = 0;
55
56 virtual const ConnectionContext& GetConnectionContext() const = 0;
57
58 // Returns the URL that was used by the source application to establish a
59 // connection to the destination application.
60 //
61 // When ApplicationConnection is representing an incoming connection this can
62 // be different than the URL the application was initially loaded from, if the
63 // application handles multiple URLs. Note that this is the URL after all
64 // URL rewriting and HTTP redirects have been performed.
65 //
66 // When ApplicationConnection is representing and outgoing connection, this
67 // will be the same as the value returned by GetRemoveApplicationURL().
68 virtual const std::string& GetConnectionURL() = 0;
69
70 // Returns the URL identifying the remote application on this connection.
71 virtual const std::string& GetRemoteApplicationURL() = 0;
72
73 private:
74 virtual void SetServiceConnectorForName(ServiceConnector* service_connector,
75 const std::string& name) = 0;
76 }; 57 };
77 58
78 } // namespace mojo 59 } // namespace mojo
79 60
80 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_ 61 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_CONNECTION_H_
OLDNEW
« no previous file with comments | « examples/bank_app/bank.cc ('k') | mojo/public/cpp/application/lib/service_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698