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 [JavaPackage="org.chromium.mojo.intent"] | 5 [JavaPackage="org.chromium.mojo.intent"] |
6 module intent_receiver; | 6 module intent_receiver; |
7 | 7 |
8 // Service to interact with android intents. | 8 // Service to interact with android intents. |
| 9 [ServiceName="intent_receiver::IntentReceiverManager"] |
9 interface IntentReceiverManager { | 10 interface IntentReceiverManager { |
10 // This method takes an |IntentReceiver| and returns a serialized intent. | 11 // This method takes an |IntentReceiver| and returns a serialized intent. |
11 // The serialized intent can be deserialized using an android parcel. The | 12 // The serialized intent can be deserialized using an android parcel. The |
12 // caller can then transform this intent into a PendingIntent using | 13 // caller can then transform this intent into a PendingIntent using |
13 // |PendingIntent#getService| and send it to another android application. | 14 // |PendingIntent#getService| and send it to another android application. |
14 // Whenever the pending intent is executed, the receiver will be called with | 15 // Whenever the pending intent is executed, the receiver will be called with |
15 // the content of the received intent. | 16 // the content of the received intent. |
16 // To be noted, this will fail if the received intent is active (contains | 17 // To be noted, this will fail if the received intent is active (contains |
17 // either a Binder or a file descriptor). | 18 // either a Binder or a file descriptor). |
18 RegisterIntentReceiver(IntentReceiver receiver) => (array<uint8>? intent); | 19 RegisterIntentReceiver(IntentReceiver receiver) => (array<uint8>? intent); |
19 | 20 |
20 // This method takes an |IntentReceiver| and returns a serialized intent. | 21 // This method takes an |IntentReceiver| and returns a serialized intent. |
21 // The serialized intent can be deserialized using an android parcel. The | 22 // The serialized intent can be deserialized using an android parcel. The |
22 // caller can then add an intent it wants the system to send using | 23 // caller can then add an intent it wants the system to send using |
23 // |Activity#startActivityForResult| and then send it using | 24 // |Activity#startActivityForResult| and then send it using |
24 // |Context#startService|. Whenever the started activity sends a result, the | 25 // |Context#startService|. Whenever the started activity sends a result, the |
25 // receiver will be called with the content of the received intent. If the | 26 // receiver will be called with the content of the received intent. If the |
26 // activity is cancelled, the receiver will be closed. | 27 // activity is cancelled, the receiver will be closed. |
27 RegisterActivityResultReceiver(IntentReceiver receiver) => | 28 RegisterActivityResultReceiver(IntentReceiver receiver) => |
28 (array<uint8>? intent); | 29 (array<uint8>? intent); |
29 }; | 30 }; |
30 | 31 |
31 // Receiver interface, to be used with |IntentReceiverManager|. | 32 // Receiver interface, to be used with |IntentReceiverManager|. |
32 interface IntentReceiver { | 33 interface IntentReceiver { |
33 OnIntent(array<uint8>? intent); | 34 OnIntent(array<uint8>? intent); |
34 }; | 35 }; |
OLD | NEW |