Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.device.bluetooth; | 5 package org.chromium.device.bluetooth; |
| 6 | 6 |
| 7 import android.Manifest; | 7 import android.Manifest; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.bluetooth.BluetoothAdapter; | 9 import android.bluetooth.BluetoothAdapter; |
| 10 import android.bluetooth.BluetoothDevice; | 10 import android.bluetooth.BluetoothDevice; |
| 11 import android.bluetooth.BluetoothGatt; | 11 import android.bluetooth.BluetoothGatt; |
| 12 import android.bluetooth.BluetoothGattCallback; | 12 import android.bluetooth.BluetoothGattCallback; |
| 13 import android.bluetooth.BluetoothGattCharacteristic; | 13 import android.bluetooth.BluetoothGattCharacteristic; |
| 14 import android.bluetooth.BluetoothGattDescriptor; | 14 import android.bluetooth.BluetoothGattDescriptor; |
| 15 import android.bluetooth.BluetoothGattService; | 15 import android.bluetooth.BluetoothGattService; |
| 16 import android.bluetooth.le.BluetoothLeScanner; | 16 import android.bluetooth.le.BluetoothLeScanner; |
| 17 import android.bluetooth.le.ScanCallback; | 17 import android.bluetooth.le.ScanCallback; |
| 18 import android.bluetooth.le.ScanFilter; | 18 import android.bluetooth.le.ScanFilter; |
| 19 import android.bluetooth.le.ScanResult; | 19 import android.bluetooth.le.ScanResult; |
| 20 import android.bluetooth.le.ScanSettings; | 20 import android.bluetooth.le.ScanSettings; |
| 21 import android.content.BroadcastReceiver; | 21 import android.content.BroadcastReceiver; |
| 22 import android.content.Context; | 22 import android.content.Context; |
| 23 import android.content.Intent; | 23 import android.content.Intent; |
| 24 import android.content.IntentFilter; | 24 import android.content.IntentFilter; |
| 25 import android.content.pm.PackageManager; | 25 import android.content.pm.PackageManager; |
| 26 import android.os.Build; | 26 import android.os.Build; |
| 27 import android.os.ParcelUuid; | 27 import android.os.ParcelUuid; |
| 28 import android.os.Process; | |
| 29 | 28 |
| 29 import org.chromium.base.LocationUtils; | |
| 30 import org.chromium.base.Log; | 30 import org.chromium.base.Log; |
| 31 import org.chromium.base.annotations.CalledByNative; | 31 import org.chromium.base.annotations.CalledByNative; |
| 32 import org.chromium.base.annotations.JNINamespace; | 32 import org.chromium.base.annotations.JNINamespace; |
| 33 | 33 |
| 34 import java.util.ArrayList; | 34 import java.util.ArrayList; |
| 35 import java.util.HashMap; | 35 import java.util.HashMap; |
| 36 import java.util.List; | 36 import java.util.List; |
| 37 import java.util.UUID; | 37 import java.util.UUID; |
| 38 | 38 |
| 39 /** | 39 /** |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 /** | 155 /** |
| 156 * Wraps android.content.Context. | 156 * Wraps android.content.Context. |
| 157 */ | 157 */ |
| 158 static class ContextWrapper { | 158 static class ContextWrapper { |
| 159 private final Context mContext; | 159 private final Context mContext; |
| 160 | 160 |
| 161 public ContextWrapper(Context context) { | 161 public ContextWrapper(Context context) { |
| 162 mContext = context; | 162 mContext = context; |
| 163 } | 163 } |
| 164 | 164 |
| 165 public boolean checkPermission(String permission) { | 165 public boolean chromeHasLocationPermission() { |
| 166 return mContext.checkPermission(permission, Process.myPid(), Process .myUid()) | 166 return LocationUtils.getInstance().chromiumHasLocationPermission(mCo ntext); |
|
Jeffrey Yasskin
2016/06/07 15:56:10
This is the use that pushes LocationUtils toward b
| |
| 167 == PackageManager.PERMISSION_GRANTED; | |
| 168 } | 167 } |
| 169 | 168 |
| 170 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { | 169 public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { |
| 171 return mContext.registerReceiver(receiver, filter); | 170 return mContext.registerReceiver(receiver, filter); |
| 172 } | 171 } |
| 173 | 172 |
| 174 public void unregisterReceiver(BroadcastReceiver receiver) { | 173 public void unregisterReceiver(BroadcastReceiver receiver) { |
| 175 mContext.unregisterReceiver(receiver); | 174 mContext.unregisterReceiver(receiver); |
| 176 } | 175 } |
| 177 } | 176 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 | 579 |
| 581 public byte[] getValue() { | 580 public byte[] getValue() { |
| 582 return mDescriptor.getValue(); | 581 return mDescriptor.getValue(); |
| 583 } | 582 } |
| 584 | 583 |
| 585 public boolean setValue(byte[] value) { | 584 public boolean setValue(byte[] value) { |
| 586 return mDescriptor.setValue(value); | 585 return mDescriptor.setValue(value); |
| 587 } | 586 } |
| 588 } | 587 } |
| 589 } | 588 } |
| OLD | NEW |