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