Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 package org.mozilla.gecko.util;
3 /**
4 * Callback interface for Gecko requests.
5 *
6 * For each instance of EventCallback, exactly one of sendResponse, sendError, or sendCancel
7 * must be called to prevent observer leaks. If more than one send* method is called, or if a
8 * single send method is called multiple times, an {@link IllegalStateException} will be thrown.
9 */
10 public interface EventCallback {
11 /**
12 * Sends a success response with the given data.
13 *
14 * @param response The response data to send to Gecko. Can be any of the types accepted by
15 * JSONObject#put(String, Object).
16 */
17 public void sendSuccess(Object response);
19 /**
20 * Sends an error response with the given data.
21 *
22 * @param response The response data to send to Gecko. Can be any of the types accepted by
23 * JSONObject#put(String, Object).
24 */
25 public void sendError(Object response);
27 /**
28 * Cancels the request, preventing any Gecko-side callbacks from being executed.
29 */
30 public void sendCancel();
31 }