| // Copyright 2016 The Weave Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef LIBWEAVE_SRC_ACCESS_API_HANDLER_H_ |
| #define LIBWEAVE_SRC_ACCESS_API_HANDLER_H_ |
| #include <base/memory/weak_ptr.h> |
| class AccessRevocationManager; |
| // Handles commands for 'blacklist' trait. |
| // Objects of the class subscribe for notification from CommandManager and |
| // execute incoming commands. |
| class AccessApiHandler final { |
| AccessApiHandler(Device* device, AccessRevocationManager* manager); |
| void Block(const std::weak_ptr<Command>& command); |
| void List(const std::weak_ptr<Command>& command); |
| void OnCommandDone(const std::weak_ptr<Command>& command, ErrorPtr error); |
| Device* device_{nullptr}; |
| AccessRevocationManager* manager_{nullptr}; |
| base::WeakPtrFactory<AccessApiHandler> weak_ptr_factory_{this}; |
| DISALLOW_COPY_AND_ASSIGN(AccessApiHandler); |
| #endif // LIBWEAVE_SRC_ACCESS_API_HANDLER_H_ |