messenger.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_COMPONENTS_PROXIMITY_AUTH_MESSENGER_H_
  5. #define ASH_COMPONENTS_PROXIMITY_AUTH_MESSENGER_H_
  6. namespace ash {
  7. namespace secure_channel {
  8. class ClientChannel;
  9. }
  10. } // namespace ash
  11. namespace proximity_auth {
  12. class MessengerObserver;
  13. // A messenger handling the Easy Unlock protocol, capable of parsing events from
  14. // the remote device and sending events for the local device.
  15. class Messenger {
  16. public:
  17. virtual ~Messenger() {}
  18. // Adds or removes an observer for Messenger events.
  19. virtual void AddObserver(MessengerObserver* observer) = 0;
  20. virtual void RemoveObserver(MessengerObserver* observer) = 0;
  21. // Sends an unlock event message to the remote device.
  22. virtual void DispatchUnlockEvent() = 0;
  23. // Sends a serialized SecureMessage to the remote device to decrypt the
  24. // |challenge|. OnDecryptResponse will be called for each observer when the
  25. // decrypted response is received.
  26. // TODO(isherman): Add params for the RSA private key and crypto delegate.
  27. virtual void RequestDecryption(const std::string& challenge) = 0;
  28. // Sends a simple request to the remote device to unlock the screen.
  29. // OnUnlockResponse is called for each observer when the response is returned.
  30. virtual void RequestUnlock() = 0;
  31. virtual ash::secure_channel::ClientChannel* GetChannel() const = 0;
  32. };
  33. } // namespace proximity_auth
  34. #endif // ASH_COMPONENTS_PROXIMITY_AUTH_MESSENGER_H_