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

Side by Side Diff: chromeos/components/tether/disconnect_tethering_operation.h

Issue 2857853005: [CrOS Tether] Create TetherDisconnector, which disconnects from active tethering sessions. (Closed)
Patch Set: hansberry@ comments. Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ 5 #ifndef CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_
6 #define CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ 6 #define CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chromeos/components/tether/message_transfer_operation.h" 9 #include "chromeos/components/tether/message_transfer_operation.h"
10 10
(...skipping 18 matching lines...) Expand all
29 virtual std::unique_ptr<DisconnectTetheringOperation> BuildInstance( 29 virtual std::unique_ptr<DisconnectTetheringOperation> BuildInstance(
30 const cryptauth::RemoteDevice& device_to_connect, 30 const cryptauth::RemoteDevice& device_to_connect,
31 BleConnectionManager* connection_manager); 31 BleConnectionManager* connection_manager);
32 32
33 private: 33 private:
34 static Factory* factory_instance_; 34 static Factory* factory_instance_;
35 }; 35 };
36 36
37 class Observer { 37 class Observer {
38 public: 38 public:
39 // Alerts observers when the operation has finished. |success| is true when 39 // Alerts observers when the operation has finished for device with ID
40 // the operation successfully sends the message and false otherwise. 40 // |device_id|. |success| is true when the operation successfully sends the
41 virtual void OnOperationFinished(bool success) = 0; 41 // message and false otherwise.
42 virtual void OnOperationFinished(const std::string& device_id,
43 bool success) = 0;
42 }; 44 };
43 45
44 DisconnectTetheringOperation(const cryptauth::RemoteDevice& device_to_connect, 46 DisconnectTetheringOperation(const cryptauth::RemoteDevice& device_to_connect,
45 BleConnectionManager* connection_manager); 47 BleConnectionManager* connection_manager);
46 ~DisconnectTetheringOperation() override; 48 ~DisconnectTetheringOperation() override;
47 49
48 void AddObserver(Observer* observer); 50 void AddObserver(Observer* observer);
49 void RemoveObserver(Observer* observer); 51 void RemoveObserver(Observer* observer);
50 52
51 protected: 53 protected:
54 void NotifyObserversOperationFinished(bool success);
55
52 // MessageTransferOperation: 56 // MessageTransferOperation:
53 void OnDeviceAuthenticated( 57 void OnDeviceAuthenticated(
54 const cryptauth::RemoteDevice& remote_device) override; 58 const cryptauth::RemoteDevice& remote_device) override;
55 void OnOperationFinished() override; 59 void OnOperationFinished() override;
56 MessageType GetMessageTypeForConnection() override; 60 MessageType GetMessageTypeForConnection() override;
57 61
58 private: 62 private:
59 friend class DisconnectTetheringOperationTest; 63 friend class DisconnectTetheringOperationTest;
60 64
61 base::ObserverList<Observer> observer_list_; 65 base::ObserverList<Observer> observer_list_;
66 std::string device_id_;
62 bool has_authenticated_; 67 bool has_authenticated_;
63 68
64 DISALLOW_COPY_AND_ASSIGN(DisconnectTetheringOperation); 69 DISALLOW_COPY_AND_ASSIGN(DisconnectTetheringOperation);
65 }; 70 };
66 71
67 } // namespace tether 72 } // namespace tether
68 73
69 } // namespace chromeos 74 } // namespace chromeos
70 75
71 #endif // CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ 76 #endif // CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_
OLDNEW
« no previous file with comments | « chromeos/components/tether/BUILD.gn ('k') | chromeos/components/tether/disconnect_tethering_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698