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

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: Rebased on master. 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
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index d851973f209d9f8a5febc4742a468555592cadf7..642f3318b71c8920e028ae811efd964be2ceeff4 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_export.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "net/log/net_log.h"
@@ -468,6 +469,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_; }
@@ -485,6 +492,7 @@ 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);
BluetoothDevice(BluetoothAdapter* adapter);
@@ -551,6 +559,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.

Powered by Google App Engine
This is Rietveld 408576698