rejecting_authenticator.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2015 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. #include "remoting/protocol/rejecting_authenticator.h"
  5. #include "base/callback.h"
  6. #include "base/check_op.h"
  7. #include "base/notreached.h"
  8. #include "remoting/protocol/channel_authenticator.h"
  9. #include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
  10. namespace remoting {
  11. namespace protocol {
  12. RejectingAuthenticator::RejectingAuthenticator(RejectionReason rejection_reason)
  13. : rejection_reason_(rejection_reason) {
  14. }
  15. RejectingAuthenticator::~RejectingAuthenticator() = default;
  16. Authenticator::State RejectingAuthenticator::state() const {
  17. return state_;
  18. }
  19. bool RejectingAuthenticator::started() const {
  20. return true;
  21. }
  22. Authenticator::RejectionReason
  23. RejectingAuthenticator::rejection_reason() const {
  24. DCHECK_EQ(state_, REJECTED);
  25. return rejection_reason_;
  26. }
  27. void RejectingAuthenticator::ProcessMessage(
  28. const jingle_xmpp::XmlElement* message,
  29. base::OnceClosure resume_callback) {
  30. DCHECK_EQ(state_, WAITING_MESSAGE);
  31. state_ = REJECTED;
  32. std::move(resume_callback).Run();
  33. }
  34. std::unique_ptr<jingle_xmpp::XmlElement> RejectingAuthenticator::GetNextMessage() {
  35. NOTREACHED();
  36. return nullptr;
  37. }
  38. const std::string& RejectingAuthenticator::GetAuthKey() const {
  39. NOTREACHED();
  40. return auth_key_;
  41. }
  42. std::unique_ptr<ChannelAuthenticator>
  43. RejectingAuthenticator::CreateChannelAuthenticator() const {
  44. NOTREACHED();
  45. return nullptr;
  46. }
  47. } // namespace protocol
  48. } // namespace remoting