1// Copyright 2013 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
5#ifndef REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_LINUX_H_
6#define REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_LINUX_H_
7
8#include "remoting/protocol/pairing_registry.h"
9
10#include "base/files/file_path.h"
11
12namespace base {
13class ListValue;
14}  // namespace base
15
16namespace remoting {
17
18class PairingRegistryDelegateLinux
19    : public protocol::PairingRegistry::Delegate {
20 public:
21  PairingRegistryDelegateLinux();
22  virtual ~PairingRegistryDelegateLinux();
23
24  // PairingRegistry::Delegate interface
25  virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE;
26  virtual bool DeleteAll() OVERRIDE;
27  virtual protocol::PairingRegistry::Pairing Load(
28      const std::string& client_id) OVERRIDE;
29  virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) OVERRIDE;
30  virtual bool Delete(const std::string& client_id) OVERRIDE;
31
32 private:
33  FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, SaveAndLoad);
34  FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, Stateless);
35
36  // Return the path to the directory to use for loading and saving paired
37  // clients.
38  base::FilePath GetRegistryPath();
39
40  // For testing purposes, set the path returned by |GetRegistryPath()|.
41  void SetRegistryPathForTesting(const base::FilePath& registry_path);
42
43  base::FilePath registry_path_for_testing_;
44
45  DISALLOW_COPY_AND_ASSIGN(PairingRegistryDelegateLinux);
46};
47
48}  // namespace remoting
49
50#endif  // REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_LINUX_H_
51