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