blob: c42e34a935784e00f1ee7527c07572af80b20666 [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <fuchsia/modular/cpp/fidl.h>
#include <lib/async/cpp/operation.h>
#include "peridot/lib/ledger_client/ledger_client.h"
#include "peridot/lib/ledger_client/page_client.h"
namespace modular {
// |ClipboardStorage| manages serialization of clipboard data to and from the
// Ledger.
// A Ledger is scoped to a single user, so each user has their own clipboard.
// Using the Ledger for the clipboard means that the same clipboard is shared
// across all of a user's devices. The clipboard will also persist across
// reboots.
class ClipboardStorage : public PageClient {
ClipboardStorage(LedgerClient* ledger_client, LedgerPageId page_id);
~ClipboardStorage() override;
// Stores the provided text.
void Push(const fidl::StringPtr& text);
// Returns the most recent value that was passed to |Push()|, or "" if nothing
// has been pushed yet.
void Peek(const std::function<void(fidl::StringPtr)>& callback);
OperationQueue operation_queue_;
class PushCall;
class PeekCall;
} // namespace modular