OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 The Android Open Source Project | 2 * Copyright (C) 2015 The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
11 * distributed under the License is distributed on an "AS IS" BASIS, | 11 * distributed under the License is distributed on an "AS IS" BASIS, |
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 * See the License for the specific language governing permissions and | 13 * See the License for the specific language governing permissions and |
14 * limitations under the License. | 14 * limitations under the License. |
15 */ | 15 */ |
16 | 16 |
17 package android.support.customtabs; | 17 package android.support.customtabs; |
18 | 18 |
19 import android.net.Uri; | 19 import android.net.Uri; |
20 import android.os.Bundle; | 20 import android.os.Bundle; |
21 | 21 |
22 import org.chromium.base.annotations.SuppressFBWarnings; | |
23 | |
24 /** | 22 /** |
25 * A callback class for custom tabs client to get messages regarding events in t
heir custom tabs. In | 23 * A callback class for custom tabs client to get messages regarding events in t
heir custom tabs. In |
26 * the implementation, all callbacks are sent to the UI thread for the client. | 24 * the implementation, all callbacks are sent to the UI thread for the client. |
27 */ | 25 */ |
28 public class CustomTabsCallback { | 26 public class CustomTabsCallback { |
29 /** | 27 /** |
30 * Sent when the tab has started loading a page. | 28 * Sent when the tab has started loading a page. |
31 */ | 29 */ |
32 public static final int NAVIGATION_STARTED = 1; | 30 public static final int NAVIGATION_STARTED = 1; |
33 | 31 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 public void onNavigationEvent(int navigationEvent, Bundle extras) {} | 64 public void onNavigationEvent(int navigationEvent, Bundle extras) {} |
67 | 65 |
68 /** | 66 /** |
69 * Sent when {@link CustomTabsSession} has requested a postMessage channel t
hrough | 67 * Sent when {@link CustomTabsSession} has requested a postMessage channel t
hrough |
70 * {@link CustomTabsService#validatePostMessageOrigin(CustomTabsSessionToken
)} and the channel | 68 * {@link CustomTabsService#validatePostMessageOrigin(CustomTabsSessionToken
)} and the channel |
71 * is ready for sending and receiving messages on both ends. | 69 * is ready for sending and receiving messages on both ends. |
72 * @param origin The web origin that has been validated and will be used in
all messages coming | 70 * @param origin The web origin that has been validated and will be used in
all messages coming |
73 * from this {@link CustomTabsSession}. | 71 * from this {@link CustomTabsSession}. |
74 * @param extras Reserved for future use. | 72 * @param extras Reserved for future use. |
75 */ | 73 */ |
76 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | |
77 public synchronized void onMessageChannelReady(Uri origin, Bundle extras) {} | 74 public synchronized void onMessageChannelReady(Uri origin, Bundle extras) {} |
78 | 75 |
79 /** | 76 /** |
80 * Sent when a tab controlled by this {@link CustomTabsSession} has sent a p
ostMessage message. | 77 * Sent when a tab controlled by this {@link CustomTabsSession} has sent a p
ostMessage message. |
81 * If postMessage() is called from a single thread, then the messages will b
e posted in the same | 78 * If postMessage() is called from a single thread, then the messages will b
e posted in the same |
82 * order. When received on the client side, it is the client's responsibilit
y to preserve the | 79 * order. When received on the client side, it is the client's responsibilit
y to preserve the |
83 * ordering further. | 80 * ordering further. |
84 * | 81 * |
85 * @param message The message sent. | 82 * @param message The message sent. |
86 * @param extras Reserved for future use. | 83 * @param extras Reserved for future use. |
87 */ | 84 */ |
88 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | |
89 public synchronized void onPostMessage(String message, Bundle extras) {} | 85 public synchronized void onPostMessage(String message, Bundle extras) {} |
90 | 86 |
91 /** | 87 /** |
92 * Unsupported callbacks that may be provided by the implementation. | 88 * Unsupported callbacks that may be provided by the implementation. |
93 * | 89 * |
94 * <p> | 90 * <p> |
95 * <strong>Note:</strong>Clients should <strong>never</strong> rely on this
callback to be | 91 * <strong>Note:</strong>Clients should <strong>never</strong> rely on this
callback to be |
96 * called and/or to have a defined behavior, as it is entirely implementatio
n-defined and not | 92 * called and/or to have a defined behavior, as it is entirely implementatio
n-defined and not |
97 * supported. | 93 * supported. |
98 * | 94 * |
99 * <p> This can be used by implementations to add extra callbacks, for testi
ng or experimental | 95 * <p> This can be used by implementations to add extra callbacks, for testi
ng or experimental |
100 * purposes. | 96 * purposes. |
101 * | 97 * |
102 * @param callbackName Name of the extra callback. | 98 * @param callbackName Name of the extra callback. |
103 * @param args Arguments for the calback | 99 * @param args Arguments for the calback |
104 */ | 100 */ |
105 public void extraCallback(String callbackName, Bundle args) {} | 101 public void extraCallback(String callbackName, Bundle args) {} |
106 } | 102 } |
OLD | NEW |