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.content.Intent; | 19 import android.content.Intent; |
20 import android.net.Uri; | 20 import android.net.Uri; |
21 import android.os.Bundle; | 21 import android.os.Bundle; |
22 import android.os.IBinder; | 22 import android.os.IBinder; |
23 import android.os.RemoteException; | 23 import android.os.RemoteException; |
24 import android.support.v4.app.BundleCompat; | 24 import android.support.v4.app.BundleCompat; |
25 import android.util.Log; | 25 import android.util.Log; |
26 | 26 |
27 import org.chromium.base.annotations.SuppressFBWarnings; | |
28 | |
29 /** | 27 /** |
30 * Wrapper class that can be used as a unique identifier for a session. Also con
tains an accessor | 28 * Wrapper class that can be used as a unique identifier for a session. Also con
tains an accessor |
31 * for the {@link CustomTabsCallback} for the session if there was any. | 29 * for the {@link CustomTabsCallback} for the session if there was any. |
32 */ | 30 */ |
33 public class CustomTabsSessionToken { | 31 public class CustomTabsSessionToken { |
34 private static final String TAG = "CustomTabsSessionToken"; | 32 private static final String TAG = "CustomTabsSessionToken"; |
35 private final ICustomTabsCallback mCallbackBinder; | 33 private final ICustomTabsCallback mCallbackBinder; |
36 private final CustomTabsCallback mCallback; | 34 private final CustomTabsCallback mCallback; |
37 | 35 |
38 /* package */ static class DummyCallback extends ICustomTabsCallback.Stub { | 36 /* package */ static class DummyCallback extends ICustomTabsCallback.Stub { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 83 |
86 @Override | 84 @Override |
87 public void onNavigationEvent(int navigationEvent, Bundle extras) { | 85 public void onNavigationEvent(int navigationEvent, Bundle extras) { |
88 try { | 86 try { |
89 mCallbackBinder.onNavigationEvent(navigationEvent, extras); | 87 mCallbackBinder.onNavigationEvent(navigationEvent, extras); |
90 } catch (RemoteException e) { | 88 } catch (RemoteException e) { |
91 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); | 89 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); |
92 } | 90 } |
93 } | 91 } |
94 | 92 |
95 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | |
96 @Override | 93 @Override |
97 public synchronized void onMessageChannelReady(Uri origin, Bundle ex
tras) { | 94 public synchronized void onMessageChannelReady(Uri origin, Bundle ex
tras) { |
98 try { | 95 try { |
99 mCallbackBinder.onMessageChannelReady(origin, extras); | 96 mCallbackBinder.onMessageChannelReady(origin, extras); |
100 } catch (RemoteException e) { | 97 } catch (RemoteException e) { |
101 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); | 98 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); |
102 } | 99 } |
103 } | 100 } |
104 | 101 |
105 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | |
106 @Override | 102 @Override |
107 public synchronized void onPostMessage(String message, Bundle extras
) { | 103 public synchronized void onPostMessage(String message, Bundle extras
) { |
108 try { | 104 try { |
109 mCallbackBinder.onPostMessage(message, extras); | 105 mCallbackBinder.onPostMessage(message, extras); |
110 } catch (RemoteException e) { | 106 } catch (RemoteException e) { |
111 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); | 107 Log.e(TAG, "RemoteException during ICustomTabsCallback trans
action"); |
112 } | 108 } |
113 } | 109 } |
114 | 110 |
115 @Override | 111 @Override |
(...skipping 25 matching lines...) Expand all Loading... |
141 } | 137 } |
142 | 138 |
143 /** | 139 /** |
144 * @return {@link CustomTabsCallback} corresponding to this session if there
was any non-null | 140 * @return {@link CustomTabsCallback} corresponding to this session if there
was any non-null |
145 * callbacks passed by the client. | 141 * callbacks passed by the client. |
146 */ | 142 */ |
147 public CustomTabsCallback getCallback() { | 143 public CustomTabsCallback getCallback() { |
148 return mCallback; | 144 return mCallback; |
149 } | 145 } |
150 } | 146 } |
OLD | NEW |