Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: device/bluetooth/bluetooth_adapter_android.cc

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test for ItemChooserDialog Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "device/bluetooth/bluetooth_adapter_android.h" 5 #include "device/bluetooth/bluetooth_adapter_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const JavaParamRef<jobject>& 161 const JavaParamRef<jobject>&
162 advertised_uuids) { // Java Type: List<ParcelUuid> 162 advertised_uuids) { // Java Type: List<ParcelUuid>
163 std::string device_address = ConvertJavaStringToUTF8(env, address); 163 std::string device_address = ConvertJavaStringToUTF8(env, address);
164 DevicesMap::const_iterator iter = devices_.find(device_address); 164 DevicesMap::const_iterator iter = devices_.find(device_address);
165 165
166 if (iter == devices_.end()) { 166 if (iter == devices_.end()) {
167 // New device. 167 // New device.
168 BluetoothDeviceAndroid* device_android = 168 BluetoothDeviceAndroid* device_android =
169 BluetoothDeviceAndroid::Create(this, bluetooth_device_wrapper); 169 BluetoothDeviceAndroid::Create(this, bluetooth_device_wrapper);
170 device_android->UpdateAdvertisedUUIDs(advertised_uuids); 170 device_android->UpdateAdvertisedUUIDs(advertised_uuids);
171 device_android->UpdateTimestamp();
171 devices_.add(device_address, scoped_ptr<BluetoothDevice>(device_android)); 172 devices_.add(device_address, scoped_ptr<BluetoothDevice>(device_android));
172 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 173 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
173 DeviceAdded(this, device_android)); 174 DeviceAdded(this, device_android));
174 } else { 175 } else {
175 // Existing device. 176 // Existing device.
176 BluetoothDeviceAndroid* device_android = 177 BluetoothDeviceAndroid* device_android =
177 static_cast<BluetoothDeviceAndroid*>(iter->second); 178 static_cast<BluetoothDeviceAndroid*>(iter->second);
179 device_android->UpdateTimestamp();
178 if (device_android->UpdateAdvertisedUUIDs(advertised_uuids)) { 180 if (device_android->UpdateAdvertisedUUIDs(advertised_uuids)) {
179 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 181 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
180 DeviceChanged(this, device_android)); 182 DeviceChanged(this, device_android));
181 } 183 }
182 } 184 }
183 } 185 }
184 186
185 BluetoothAdapterAndroid::BluetoothAdapterAndroid() : weak_ptr_factory_(this) { 187 BluetoothAdapterAndroid::BluetoothAdapterAndroid() : weak_ptr_factory_(this) {
186 } 188 }
187 189
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // TODO(scheib): Support filters crbug.com/490401 226 // TODO(scheib): Support filters crbug.com/490401
225 NOTIMPLEMENTED(); 227 NOTIMPLEMENTED();
226 error_callback.Run(UMABluetoothDiscoverySessionOutcome::NOT_IMPLEMENTED); 228 error_callback.Run(UMABluetoothDiscoverySessionOutcome::NOT_IMPLEMENTED);
227 } 229 }
228 230
229 void BluetoothAdapterAndroid::RemovePairingDelegateInternal( 231 void BluetoothAdapterAndroid::RemovePairingDelegateInternal(
230 device::BluetoothDevice::PairingDelegate* pairing_delegate) { 232 device::BluetoothDevice::PairingDelegate* pairing_delegate) {
231 } 233 }
232 234
233 } // namespace device 235 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698