Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package application | 5 package application |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "log" | 8 "log" |
| 9 | 9 |
| 10 "mojo/public/go/bindings" | 10 "mojo/public/go/bindings" |
| 11 "mojo/public/go/system" | 11 "mojo/public/go/system" |
| 12 | 12 |
| 13 sp "mojo/public/interfaces/application/service_provider" | 13 sp "mojo/public/interfaces/application/service_provider" |
| 14 "mojo/public/interfaces/bindings/mojom_types" | |
| 14 ) | 15 ) |
| 15 | 16 |
| 16 type connectionInfo struct { | 17 type connectionInfo struct { |
| 17 requestorURL string | 18 requestorURL string |
| 18 connectionURL string | 19 connectionURL string |
| 19 } | 20 } |
| 20 | 21 |
| 21 // RequestorURL returns the URL of application that established the connection. | 22 // RequestorURL returns the URL of application that established the connection. |
| 22 func (c *connectionInfo) RequestorURL() string { | 23 func (c *connectionInfo) RequestorURL() string { |
| 23 return c.requestorURL | 24 return c.requestorURL |
| 24 } | 25 } |
| 25 | 26 |
| 26 // ConnectionURL returns the URL that was used by the source application to | 27 // ConnectionURL returns the URL that was used by the source application to |
| 27 // establish a connection to the destination application. | 28 // establish a connection to the destination application. |
| 28 func (c *connectionInfo) ConnectionURL() string { | 29 func (c *connectionInfo) ConnectionURL() string { |
| 29 return c.connectionURL | 30 return c.connectionURL |
| 30 } | 31 } |
| 31 | 32 |
| 32 // ServiceRequest is an interface request for a specified mojo service. | 33 // ServiceRequest is an interface request for a specified mojo service. |
| 33 type ServiceRequest interface { | 34 type ServiceRequest interface { |
|
rudominer
2015/10/14 05:15:41
This does not seem right to me. I don't see why yo
rudominer
2015/10/14 06:17:55
Sorry, I spoke to soon. I now see that in your CL
alexfandrianto
2015/10/14 06:44:50
I actually expose Type() and Desc() for the client
| |
| 34 // Name returns the name of requested mojo service. | 35 // Name returns the name of requested mojo service. |
| 35 Name() string | 36 Name() string |
| 36 | 37 |
| 38 // Type returns a type description of the interface. | |
| 39 Type() mojom_types.MojomInterface | |
| 40 | |
| 41 // Descriptor returns the mapping between string identifiers and relevan t UserDefinedTypes. | |
| 42 Desc() map[string]mojom_types.UserDefinedType | |
| 43 | |
| 37 // PassMessagePipe passes ownership of the underlying message pipe | 44 // PassMessagePipe passes ownership of the underlying message pipe |
| 38 // handle to the newly created handle object, invalidating the | 45 // handle to the newly created handle object, invalidating the |
| 39 // underlying handle object in the process. | 46 // underlying handle object in the process. |
| 40 PassMessagePipe() system.MessagePipeHandle | 47 PassMessagePipe() system.MessagePipeHandle |
| 41 } | 48 } |
| 42 | 49 |
| 43 // ServiceFactory provides implementation of a mojo service. | 50 // ServiceFactory provides implementation of a mojo service. |
| 44 type ServiceFactory interface { | 51 type ServiceFactory interface { |
| 45 // Name returns the name of provided mojo service. | 52 // Name returns the name of provided mojo service. |
| 46 Name() string | 53 Name() string |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 messagePipe.Close() | 174 messagePipe.Close() |
| 168 return nil | 175 return nil |
| 169 } | 176 } |
| 170 factory.Create(messagePipe) | 177 factory.Create(messagePipe) |
| 171 return nil | 178 return nil |
| 172 } | 179 } |
| 173 | 180 |
| 174 func (sp *serviceProviderImpl) AddService(factory ServiceFactory) { | 181 func (sp *serviceProviderImpl) AddService(factory ServiceFactory) { |
| 175 sp.factories[factory.Name()] = factory | 182 sp.factories[factory.Name()] = factory |
| 176 } | 183 } |
| OLD | NEW |