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

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

Issue 2857853005: [CrOS Tether] Create TetherDisconnector, which disconnects from active tethering sessions. (Closed)
Patch Set: hansberry@ comments. 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/disconnect_tethering_operation.cc
diff --git a/chromeos/components/tether/disconnect_tethering_operation.cc b/chromeos/components/tether/disconnect_tethering_operation.cc
index f8ba990672e9dda82e45a0a223881292b210d2c2..72b2218b0ade078a83bc2804f0d1bd6ad484195f 100644
--- a/chromeos/components/tether/disconnect_tethering_operation.cc
+++ b/chromeos/components/tether/disconnect_tethering_operation.cc
@@ -48,6 +48,7 @@ DisconnectTetheringOperation::DisconnectTetheringOperation(
: MessageTransferOperation(
std::vector<cryptauth::RemoteDevice>{device_to_connect},
connection_manager),
+ device_id_(device_to_connect.GetDeviceId()),
has_authenticated_(false) {}
DisconnectTetheringOperation::~DisconnectTetheringOperation() {}
@@ -60,6 +61,13 @@ void DisconnectTetheringOperation::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
}
+void DisconnectTetheringOperation::NotifyObserversOperationFinished(
+ bool success) {
+ for (auto& observer : observer_list_) {
+ observer.OnOperationFinished(device_id_, success);
+ }
+}
+
void DisconnectTetheringOperation::OnDeviceAuthenticated(
const cryptauth::RemoteDevice& remote_device) {
DCHECK(remote_devices().size() == 1u && remote_devices()[0] == remote_device);
@@ -71,9 +79,7 @@ void DisconnectTetheringOperation::OnDeviceAuthenticated(
}
void DisconnectTetheringOperation::OnOperationFinished() {
- for (auto& observer : observer_list_) {
- observer.OnOperationFinished(has_authenticated_);
- }
+ NotifyObserversOperationFinished(has_authenticated_);
}
MessageType DisconnectTetheringOperation::GetMessageTypeForConnection() {

Powered by Google App Engine
This is Rietveld 408576698