blob: f6fc9e26ba230829b1fe84969ac9bf6b295de48e [file] [log] [blame]
// Copyright 2019 The Chromium OS 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 CRYPTOHOME_GLIB_TRANSITION_H_
#define CRYPTOHOME_GLIB_TRANSITION_H_
#include <utility>
#include <base/callback.h>
#include "cryptohome/cryptohome_event_source.h"
namespace cryptohome {
constexpr char kClosureEventType[] = "ClosureEvent";
class ClosureEvent : public CryptohomeEventBase {
public:
explicit ClosureEvent(base::OnceClosure closure)
: closure_(std::move(closure)) {
// Nothing to do here
}
virtual ~ClosureEvent() {}
virtual const char* GetEventName() const { return kClosureEventType; }
virtual void Run() { std::move(closure_).Run(); }
private:
base::OnceClosure closure_;
};
} // namespace cryptohome
#endif // CRYPTOHOME_GLIB_TRANSITION_H_