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.
5 #ifndef REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_
6 #define REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/win/registry.h"
14 #include "remoting/protocol/pairing_registry.h"
22 // Stores client pairing information in Windows registry. Two separate registry
24 // - |privileged| - contains the shared secrets of all pairings. This key must
25 // be protected by a strong ACL denying access to unprivileged
27 // - |unprivileged| - contains the rest of pairing state.
29 // Creator of this object is responsible for passing the registry key handles
30 // with appropriate access. |privileged| may be NULL if read-only access is
31 // sufficient. Shared secrets will not be returned in such a case.
32 class PairingRegistryDelegateWin
33 : public protocol::PairingRegistry::Delegate {
35 PairingRegistryDelegateWin();
36 virtual ~PairingRegistryDelegateWin();
38 // Passes the root keys to be used to access the pairing registry store.
39 // |privileged| is optional and may be NULL. The caller retains ownership of
40 // the passed handles.
41 bool SetRootKeys(HKEY privileged, HKEY unprivileged);
43 // PairingRegistry::Delegate interface
44 virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE;
45 virtual bool DeleteAll() OVERRIDE;
46 virtual protocol::PairingRegistry::Pairing Load(
47 const std::string& client_id) OVERRIDE;
48 virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) OVERRIDE;
49 virtual bool Delete(const std::string& client_id) OVERRIDE;
52 base::win::RegKey privileged_;
53 base::win::RegKey unprivileged_;
55 DISALLOW_COPY_AND_ASSIGN(PairingRegistryDelegateWin);
58 } // namespace remoting
60 #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_