| 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 12 matching lines...) Expand all Loading... |
| 23 import android.content.pm.PackageManager; | 23 import android.content.pm.PackageManager; |
| 24 import android.content.pm.ResolveInfo; | 24 import android.content.pm.ResolveInfo; |
| 25 import android.net.Uri; | 25 import android.net.Uri; |
| 26 import android.os.Bundle; | 26 import android.os.Bundle; |
| 27 import android.os.Handler; | 27 import android.os.Handler; |
| 28 import android.os.Looper; | 28 import android.os.Looper; |
| 29 import android.os.RemoteException; | 29 import android.os.RemoteException; |
| 30 import android.support.annotation.Nullable; | 30 import android.support.annotation.Nullable; |
| 31 import android.text.TextUtils; | 31 import android.text.TextUtils; |
| 32 | 32 |
| 33 import org.chromium.base.annotations.SuppressFBWarnings; |
| 34 |
| 33 import java.util.ArrayList; | 35 import java.util.ArrayList; |
| 34 import java.util.List; | 36 import java.util.List; |
| 35 | 37 |
| 36 /** | 38 /** |
| 37 * Class to communicate with a {@link CustomTabsService} and create | 39 * Class to communicate with a {@link CustomTabsService} and create |
| 38 * {@link CustomTabsSession} from it. | 40 * {@link CustomTabsSession} from it. |
| 39 */ | 41 */ |
| 40 public class CustomTabsClient { | 42 public class CustomTabsClient { |
| 41 private final ICustomTabsService mService; | 43 private final ICustomTabsService mService; |
| 42 private final ComponentName mServiceComponentName; | 44 private final ComponentName mServiceComponentName; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 public void onNavigationEvent(final int navigationEvent, final Bundl
e extras) { | 190 public void onNavigationEvent(final int navigationEvent, final Bundl
e extras) { |
| 189 if (callback == null) return; | 191 if (callback == null) return; |
| 190 mHandler.post(new Runnable() { | 192 mHandler.post(new Runnable() { |
| 191 @Override | 193 @Override |
| 192 public void run() { | 194 public void run() { |
| 193 callback.onNavigationEvent(navigationEvent, extras); | 195 callback.onNavigationEvent(navigationEvent, extras); |
| 194 } | 196 } |
| 195 }); | 197 }); |
| 196 } | 198 } |
| 197 | 199 |
| 200 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
| 198 @Override | 201 @Override |
| 199 public synchronized void onMessageChannelReady(final Uri origin, fin
al Bundle extras) { | 202 public synchronized void onMessageChannelReady(final Uri origin, fin
al Bundle extras) { |
| 200 if (callback == null) return; | 203 if (callback == null) return; |
| 201 mHandler.post(new Runnable() { | 204 mHandler.post(new Runnable() { |
| 202 @Override | 205 @Override |
| 203 public void run() { | 206 public void run() { |
| 204 callback.onMessageChannelReady(origin, extras); | 207 callback.onMessageChannelReady(origin, extras); |
| 205 } | 208 } |
| 206 }); | 209 }); |
| 207 } | 210 } |
| 208 | 211 |
| 212 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
| 209 @Override | 213 @Override |
| 210 public synchronized void onPostMessage(final String message, final B
undle extras) { | 214 public synchronized void onPostMessage(final String message, final B
undle extras) { |
| 211 if (callback == null) return; | 215 if (callback == null) return; |
| 212 mHandler.post(new Runnable() { | 216 mHandler.post(new Runnable() { |
| 213 @Override | 217 @Override |
| 214 public void run() { | 218 public void run() { |
| 215 callback.onPostMessage(message, extras); | 219 callback.onPostMessage(message, extras); |
| 216 } | 220 } |
| 217 }); | 221 }); |
| 218 } | 222 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 239 } | 243 } |
| 240 | 244 |
| 241 public Bundle extraCommand(String commandName, Bundle args) { | 245 public Bundle extraCommand(String commandName, Bundle args) { |
| 242 try { | 246 try { |
| 243 return mService.extraCommand(commandName, args); | 247 return mService.extraCommand(commandName, args); |
| 244 } catch (RemoteException e) { | 248 } catch (RemoteException e) { |
| 245 return null; | 249 return null; |
| 246 } | 250 } |
| 247 } | 251 } |
| 248 } | 252 } |
| OLD | NEW |