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

Unified Diff: chromeos/components/tether/tether_host_response_recorder.cc

Issue 2861443002: (Fix landed) Revert of [CrOS Tether] Create HostScanCache, which caches scan results and inserts... (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/components/tether/tether_host_response_recorder.cc
diff --git a/chromeos/components/tether/tether_host_response_recorder.cc b/chromeos/components/tether/tether_host_response_recorder.cc
index c284ed9103c5b8687d4dd466bb605ae3c04e2d8d..7012fa67009c47235e8de8c8c90a70e82593526e 100644
--- a/chromeos/components/tether/tether_host_response_recorder.cc
+++ b/chromeos/components/tether/tether_host_response_recorder.cc
@@ -26,14 +26,6 @@
TetherHostResponseRecorder::~TetherHostResponseRecorder() {}
-void TetherHostResponseRecorder::AddObserver(Observer* observer) {
- observer_list_.AddObserver(observer);
-}
-
-void TetherHostResponseRecorder::RemoveObserver(Observer* observer) {
- observer_list_.RemoveObserver(observer);
-}
-
void TetherHostResponseRecorder::RecordSuccessfulTetherAvailabilityResponse(
const cryptauth::RemoteDevice& remote_device) {
AddRecentResponse(remote_device.GetDeviceId(),
@@ -47,10 +39,8 @@
void TetherHostResponseRecorder::RecordSuccessfulConnectTetheringResponse(
const cryptauth::RemoteDevice& remote_device) {
- if (AddRecentResponse(remote_device.GetDeviceId(),
- prefs::kMostRecentConnectTetheringResponderIds)) {
- NotifyObserversPreviouslyConnectedHostIdsChanged();
- }
+ AddRecentResponse(remote_device.GetDeviceId(),
+ prefs::kMostRecentConnectTetheringResponderIds);
}
std::vector<std::string>
@@ -58,25 +48,10 @@
return GetDeviceIdsForPref(prefs::kMostRecentConnectTetheringResponderIds);
}
-void TetherHostResponseRecorder::
- NotifyObserversPreviouslyConnectedHostIdsChanged() {
- for (Observer& observer : observer_list_) {
- observer.OnPreviouslyConnectedHostIdsChanged();
- }
-}
-
-bool TetherHostResponseRecorder::AddRecentResponse(
+void TetherHostResponseRecorder::AddRecentResponse(
const std::string& device_id,
const std::string& pref_name) {
const base::ListValue* ids = pref_service_->GetList(pref_name);
-
- std::string first_device_id_in_list;
- ids->GetString(0u, &first_device_id_in_list);
- if (device_id == first_device_id_in_list) {
- // If the device ID that is being inserted is already at the front of the
- // list, there is nothing to do.
- return false;
- }
// Create a mutable copy of the stored IDs, or create one if it has yet to be
// stored.
@@ -93,8 +68,6 @@
// Store the updated list back in |pref_service_|.
pref_service_->Set(pref_name, *updated_ids);
-
- return true;
}
std::vector<std::string> TetherHostResponseRecorder::GetDeviceIdsForPref(

Powered by Google App Engine
This is Rietveld 408576698