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

Unified Diff: device/bluetooth/bluetooth_device.h

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted two small unnecessary changes. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 859f51afd2feb35ba35a15707e13c1e1210a759b..6b9f24452d2224f7501e5e12b99eefbf71b8c456 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -18,6 +18,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
+#include "base/time/time.h"
#include "device/bluetooth/bluetooth_common.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluetooth_uuid.h"
@@ -475,6 +476,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// empty string.
static std::string CanonicalizeAddress(const std::string& address);
+ // Return the timestamp for when this device was last seen.
+ base::Time GetLastUpdateTime() const { return last_update_time_; }
+
+ // Update the last time this device was seen.
+ void UpdateTimestamp();
+
// Return associated BluetoothAdapter.
BluetoothAdapter* GetAdapter() { return adapter_; }
@@ -492,6 +499,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
FRIEND_TEST_ALL_PREFIXES(BluetoothTest,
BluetoothGattConnection_DisconnectGatt_Cleanup);
FRIEND_TEST_ALL_PREFIXES(BluetoothTest, GetDeviceName_NullName);
+ FRIEND_TEST_ALL_PREFIXES(BluetoothTest, RemoveOutdatedDevices);
+ FRIEND_TEST_ALL_PREFIXES(BluetoothTest, RemoveOutdatedDeviceGattConnect);
BluetoothDevice(BluetoothAdapter* adapter);
@@ -534,6 +543,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
void SetServiceData(BluetoothUUID serviceUUID, const char* buffer,
size_t size);
+ // Update last_update_time_ so that the device appears as expired.
+ void SetAsExpiredForTesting();
+
// Raw pointer to adapter owning this device object. Subclasses use platform
// specific pointers via adapter_.
BluetoothAdapter* adapter_;
@@ -558,6 +570,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// the specific data. The data is stored as BinaryValue.
std::unique_ptr<base::DictionaryValue> services_data_;
+ // Timestamp for when an advertisement was last seen.
+ base::Time last_update_time_;
+
private:
// Returns a localized string containing the device's bluetooth address and
// a device type for display when |name_| is empty.
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698