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