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

Unified Diff: chromeos/components/tether/keep_alive_operation.h

Issue 2741253002: [CrOS Tether] Create KeepAliveScheduler, a class which schedules keep-alive tickles to be sent to a… (Closed)
Patch Set: Add missing dependency. Created 3 years, 9 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 | « chromeos/components/tether/fake_active_host.cc ('k') | chromeos/components/tether/keep_alive_operation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/components/tether/keep_alive_operation.h
diff --git a/chromeos/components/tether/keep_alive_operation.h b/chromeos/components/tether/keep_alive_operation.h
index c5099e90bd86117b78aa61ba347dd8271319b3b1..20193a84ccc06fff47a8570c633a58f1862b88f5 100644
--- a/chromeos/components/tether/keep_alive_operation.h
+++ b/chromeos/components/tether/keep_alive_operation.h
@@ -5,6 +5,7 @@
#ifndef CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_
#define CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_
+#include "base/observer_list.h"
#include "chromeos/components/tether/message_transfer_operation.h"
namespace chromeos {
@@ -14,9 +15,8 @@ namespace tether {
class BleConnectionManager;
// Operation which sends a keep-alive message to a tether host.
-// TODO(khorimoto/hansberry): Consider changing protocol to receive a
-// DeviceStatus update after sending the
-// KeepAliveTickle message.
+// TODO(khorimoto/hansberry): Change protocol to receive a DeviceStatus update
+// after sending the KeepAliveTickle message.
class KeepAliveOperation : public MessageTransferOperation {
public:
class Factory {
@@ -29,13 +29,20 @@ class KeepAliveOperation : public MessageTransferOperation {
protected:
virtual std::unique_ptr<KeepAliveOperation> BuildInstance(
- const cryptauth::RemoteDevice& devices_to_connect,
+ const cryptauth::RemoteDevice& device_to_connect,
BleConnectionManager* connection_manager);
private:
static Factory* factory_instance_;
};
+ class Observer {
+ public:
+ // TODO(khorimoto): This function should take a DeviceStatus once there is
+ // keep-alive tickle response.
+ virtual void OnOperationFinished() = 0;
+ };
+
KeepAliveOperation(const cryptauth::RemoteDevice& device_to_connect,
BleConnectionManager* connection_manager);
~KeepAliveOperation() override;
@@ -47,11 +54,15 @@ class KeepAliveOperation : public MessageTransferOperation {
// MessageTransferOperation:
void OnDeviceAuthenticated(
const cryptauth::RemoteDevice& remote_device) override;
+ void OnOperationFinished() override;
MessageType GetMessageTypeForConnection() override;
private:
friend class KeepAliveOperationTest;
+ base::ObserverList<Observer> observer_list_;
+ bool has_authenticated_;
+
DISALLOW_COPY_AND_ASSIGN(KeepAliveOperation);
};
« no previous file with comments | « chromeos/components/tether/fake_active_host.cc ('k') | chromeos/components/tether/keep_alive_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698