OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 import "sample_import.mojom" |
| 6 |
5 [JavaPackage="org.chromium.mojo.bindings.test.sample"] | 7 [JavaPackage="org.chromium.mojo.bindings.test.sample"] |
6 module sample { | 8 module sample { |
7 | 9 |
8 // This sample shows how handles to MessagePipes can be sent as both parameters | 10 // This sample shows how handles to MessagePipes can be sent as both parameters |
9 // to methods as well as fields on structs. | 11 // to methods as well as fields on structs. |
10 | 12 |
11 struct Request { | 13 struct Request { |
12 int32 x; | 14 int32 x; |
13 handle<message_pipe> pipe; | 15 handle<message_pipe> pipe; |
14 handle<message_pipe>[] more_pipes; | 16 handle<message_pipe>[] more_pipes; |
15 }; | 17 }; |
16 | 18 |
17 struct Response { | 19 struct Response { |
18 int32 x; | 20 int32 x; |
19 handle<message_pipe> pipe; | 21 handle<message_pipe> pipe; |
20 }; | 22 }; |
21 | 23 |
22 interface Object { | 24 interface Object { |
23 SetName(string name); | 25 SetName(string name); |
24 GetName() => (string name); | 26 GetName() => (string name); |
25 }; | 27 }; |
26 | 28 |
27 [Client=FactoryClient] | 29 [Client=FactoryClient] |
28 interface Factory { | 30 interface Factory { |
29 DoStuff(Request request, handle<message_pipe> pipe); | 31 DoStuff(Request request, handle<message_pipe> pipe); |
30 DoStuff2(handle<data_pipe_consumer> pipe); | 32 DoStuff2(handle<data_pipe_consumer> pipe); |
31 CreateObject(Object& obj); | 33 CreateObject(Object& obj); |
| 34 RequestImportedInterface( |
| 35 imported.ImportedInterface& obj) => (imported.ImportedInterface& obj); |
| 36 TakeImportedInterface( |
| 37 imported.ImportedInterface obj) => (imported.ImportedInterface obj); |
32 }; | 38 }; |
33 | 39 |
34 interface FactoryClient { | 40 interface FactoryClient { |
35 DidStuff(Response response, string text); | 41 DidStuff(Response response, string text); |
36 DidStuff2(string text); | 42 DidStuff2(string text); |
37 }; | 43 }; |
38 | 44 |
39 } // module sample | 45 } // module sample |
OLD | NEW |