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 #if defined(OFFICIAL_BUILD)
23 const wchar_t kPairingRegistryKeyName
[] =
24 L
"SOFTWARE\\Google\\Chrome Remote Desktop\\paired-clients";
26 const wchar_t kPairingRegistryKeyName
[] =
27 L
"SOFTWARE\\Chromoting\\paired-clients";
30 const wchar_t kPairingRegistryClientsKeyName
[] = L
"clients";
31 const wchar_t kPairingRegistrySecretsKeyName
[] = L
"secrets";
33 // Stores client pairing information in Windows registry. Two separate registry
35 // - |privileged| - contains the shared secrets of all pairings. This key must
36 // be protected by a strong ACL denying access to unprivileged
38 // - |unprivileged| - contains the rest of pairing state.
40 // Creator of this object is responsible for passing the registry key handles
41 // with appropriate access. |privileged| may be nullptr if read-only access is
42 // sufficient. Shared secrets will not be returned in such a case.
43 class PairingRegistryDelegateWin
44 : public protocol::PairingRegistry::Delegate
{
46 PairingRegistryDelegateWin();
47 ~PairingRegistryDelegateWin() override
;
49 // Passes the root keys to be used to access the pairing registry store.
50 // |privileged| is optional and may be nullptr. The caller retains ownership
51 // of the passed handles.
52 bool SetRootKeys(HKEY privileged
, HKEY unprivileged
);
54 // PairingRegistry::Delegate interface
55 scoped_ptr
<base::ListValue
> LoadAll() override
;
56 bool DeleteAll() override
;
57 protocol::PairingRegistry::Pairing
Load(
58 const std::string
& client_id
) override
;
59 bool Save(const protocol::PairingRegistry::Pairing
& pairing
) override
;
60 bool Delete(const std::string
& client_id
) override
;
63 base::win::RegKey privileged_
;
64 base::win::RegKey unprivileged_
;
66 DISALLOW_COPY_AND_ASSIGN(PairingRegistryDelegateWin
);
69 } // namespace remoting
71 #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_