scoped_protobuf_http_request.h 874 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2020 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 REMOTING_BASE_SCOPED_PROTOBUF_HTTP_REQUEST_H_
  5. #define REMOTING_BASE_SCOPED_PROTOBUF_HTTP_REQUEST_H_
  6. #include "base/callback.h"
  7. namespace remoting {
  8. // A helper class that will cancel the pending request when the instance is
  9. // deleted.
  10. class ScopedProtobufHttpRequest {
  11. public:
  12. explicit ScopedProtobufHttpRequest(base::OnceClosure request_invalidator);
  13. virtual ~ScopedProtobufHttpRequest();
  14. ScopedProtobufHttpRequest(const ScopedProtobufHttpRequest&) = delete;
  15. ScopedProtobufHttpRequest& operator=(const ScopedProtobufHttpRequest&) =
  16. delete;
  17. private:
  18. base::OnceClosure request_invalidator_;
  19. };
  20. } // namespace remoting
  21. #endif // REMOTING_BASE_SCOPED_PROTOBUF_HTTP_REQUEST_H_