Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: customtabs/src/android/support/customtabs/CustomTabsCallback.java

Issue 2438103002: Add postMessage APIs to the support lib (Closed)
Patch Set: removed unnecessary import Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | customtabs/src/android/support/customtabs/CustomTabsClient.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.os.Bundle; 20 import android.os.Bundle;
20 21
21 /** 22 /**
22 * A callback class for custom tabs client to get messages regarding events in t heir custom tabs. 23 * A callback class for custom tabs client to get messages regarding events in t heir custom tabs. In
24 * the implementation, all callbacks are sent to the UI thread for the client.
23 */ 25 */
24 public class CustomTabsCallback { 26 public class CustomTabsCallback {
25 /** 27 /**
26 * Sent when the tab has started loading a page. 28 * Sent when the tab has started loading a page.
27 */ 29 */
28 public static final int NAVIGATION_STARTED = 1; 30 public static final int NAVIGATION_STARTED = 1;
29 31
30 /** 32 /**
31 * Sent when the tab has finished loading a page. 33 * Sent when the tab has finished loading a page.
32 */ 34 */
(...skipping 22 matching lines...) Expand all
55 57
56 /** 58 /**
57 * To be called when a navigation event happens. 59 * To be called when a navigation event happens.
58 * 60 *
59 * @param navigationEvent The code corresponding to the navigation event. 61 * @param navigationEvent The code corresponding to the navigation event.
60 * @param extras Reserved for future use. 62 * @param extras Reserved for future use.
61 */ 63 */
62 public void onNavigationEvent(int navigationEvent, Bundle extras) {} 64 public void onNavigationEvent(int navigationEvent, Bundle extras) {}
63 65
64 /** 66 /**
67 * Sent when {@link CustomTabsSession} has requested a postMessage channel t hrough
68 * {@link CustomTabsService#validatePostMessageOrigin(CustomTabsSessionToken )} and the channel
69 * is ready for sending and receiving messages on both ends.
70 * @param origin The web origin that has been validated and will be used in all messages coming
71 * from this {@link CustomTabsSession}.
72 * @param extras Reserved for future use.
73 */
74 public synchronized void onMessageChannelReady(Uri origin, Bundle extras) {}
75
76 /**
77 * Sent when a tab controlled by this {@link CustomTabsSession} has sent a p ostMessage message.
78 * If postMessage() is called from a single thread, then the messages will b e posted in the same
79 * order. When received on the client side, it is the client's responsibilit y to preserve the
80 * ordering further.
81 *
82 * @param message The message sent.
83 * @param extras Reserved for future use.
84 */
85 public synchronized void onPostMessage(String message, Bundle extras) {}
86
87 /**
65 * Unsupported callbacks that may be provided by the implementation. 88 * Unsupported callbacks that may be provided by the implementation.
66 * 89 *
67 * <p> 90 * <p>
68 * <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
69 * 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
70 * supported. 93 * supported.
71 * 94 *
72 * <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
73 * purposes. 96 * purposes.
74 * 97 *
75 * @param callbackName Name of the extra callback. 98 * @param callbackName Name of the extra callback.
76 * @param args Arguments for the calback 99 * @param args Arguments for the calback
77 */ 100 */
78 public void extraCallback(String callbackName, Bundle args) {} 101 public void extraCallback(String callbackName, Bundle args) {}
79 } 102 }
OLDNEW
« no previous file with comments | « no previous file | customtabs/src/android/support/customtabs/CustomTabsClient.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698