| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 import android.graphics.Bitmap; | 21 import android.graphics.Bitmap; |
| 22 import android.net.Uri; | 22 import android.net.Uri; |
| 23 import android.os.Bundle; | 23 import android.os.Bundle; |
| 24 import android.os.IBinder; | 24 import android.os.IBinder; |
| 25 import android.os.RemoteException; | 25 import android.os.RemoteException; |
| 26 import android.support.annotation.NonNull; | 26 import android.support.annotation.NonNull; |
| 27 import android.support.customtabs.CustomTabsService.Result; | 27 import android.support.customtabs.CustomTabsService.Result; |
| 28 import android.support.customtabs.CustomTabsSessionToken.DummyCallback; | 28 import android.support.customtabs.CustomTabsSessionToken.DummyCallback; |
| 29 import android.widget.RemoteViews; | 29 import android.widget.RemoteViews; |
| 30 | 30 |
| 31 import org.chromium.base.annotations.SuppressFBWarnings; |
| 32 |
| 31 import java.util.List; | 33 import java.util.List; |
| 32 | 34 |
| 33 /** | 35 /** |
| 34 * A class to be used for Custom Tabs related communication. Clients that want t
o launch Custom Tabs | 36 * A class to be used for Custom Tabs related communication. Clients that want t
o launch Custom Tabs |
| 35 * can use this class exclusively to handle all related communication. | 37 * can use this class exclusively to handle all related communication. |
| 36 */ | 38 */ |
| 37 public final class CustomTabsSession { | 39 public final class CustomTabsSession { |
| 38 private static final String TAG = "CustomTabsSession"; | 40 private static final String TAG = "CustomTabsSession"; |
| 39 private final ICustomTabsService mService; | 41 private final ICustomTabsService mService; |
| 40 private final ICustomTabsCallback mCallback; | 42 private final ICustomTabsCallback mCallback; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 155 |
| 154 public boolean validatePostMessageOrigin() { | 156 public boolean validatePostMessageOrigin() { |
| 155 try { | 157 try { |
| 156 return mService.validatePostMessageOrigin(mCallback); | 158 return mService.validatePostMessageOrigin(mCallback); |
| 157 } catch (RemoteException e) { | 159 } catch (RemoteException e) { |
| 158 return false; | 160 return false; |
| 159 } | 161 } |
| 160 } | 162 } |
| 161 | 163 |
| 162 @Result | 164 @Result |
| 165 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
| 163 public synchronized int postMessage(String message, Bundle extras) { | 166 public synchronized int postMessage(String message, Bundle extras) { |
| 164 try { | 167 try { |
| 165 return mService.postMessage(mCallback, message, extras); | 168 return mService.postMessage(mCallback, message, extras); |
| 166 } catch (RemoteException e) { | 169 } catch (RemoteException e) { |
| 167 return CustomTabsService.RESULT_FAILURE_REMOTE_ERROR; | 170 return CustomTabsService.RESULT_FAILURE_REMOTE_ERROR; |
| 168 } | 171 } |
| 169 } | 172 } |
| 170 | 173 |
| 171 /* package */ IBinder getBinder() { | 174 /* package */ IBinder getBinder() { |
| 172 return mCallback.asBinder(); | 175 return mCallback.asBinder(); |
| 173 } | 176 } |
| 174 | 177 |
| 175 /* package */ ComponentName getComponentName() { | 178 /* package */ ComponentName getComponentName() { |
| 176 return mComponentName; | 179 return mComponentName; |
| 177 } | 180 } |
| 178 } | 181 } |
| OLD | NEW |