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