[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 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 | |||||
thestig | a0e18cd | 2015-09-25 04:58:36 | [diff] [blame] | 5 | #ifndef REMOTING_HOST_PAIRING_REGISTRY_DELEGATE_LINUX_H_ |
6 | #define REMOTING_HOST_PAIRING_REGISTRY_DELEGATE_LINUX_H_ | ||||
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 7 | |
8 | #include "remoting/protocol/pairing_registry.h" | ||||
9 | |||||
10 | #include "base/files/file_path.h" | ||||
thestig | a0e18cd | 2015-09-25 04:58:36 | [diff] [blame] | 11 | #include "base/gtest_prod_util.h" |
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 12 | |
13 | namespace base { | ||||
14 | class ListValue; | ||||
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 15 | } // namespace base |
16 | |||||
17 | namespace remoting { | ||||
18 | |||||
19 | class PairingRegistryDelegateLinux | ||||
20 | : public protocol::PairingRegistry::Delegate { | ||||
21 | public: | ||||
[email protected] | 37846603 | 2013-08-02 01:35:16 | [diff] [blame] | 22 | PairingRegistryDelegateLinux(); |
Peter Boström | e9178e4 | 2021-09-22 18:11:49 | [diff] [blame] | 23 | |
24 | PairingRegistryDelegateLinux(const PairingRegistryDelegateLinux&) = delete; | ||||
25 | PairingRegistryDelegateLinux& operator=(const PairingRegistryDelegateLinux&) = | ||||
26 | delete; | ||||
27 | |||||
dcheng | 440d8e1c | 2014-10-28 01:23:15 | [diff] [blame] | 28 | ~PairingRegistryDelegateLinux() override; |
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 29 | |
30 | // PairingRegistry::Delegate interface | ||||
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 31 | std::unique_ptr<base::ListValue> LoadAll() override; |
dcheng | 440d8e1c | 2014-10-28 01:23:15 | [diff] [blame] | 32 | bool DeleteAll() override; |
33 | protocol::PairingRegistry::Pairing Load( | ||||
mostynb | 11d989c | 2014-10-08 16:58:09 | [diff] [blame] | 34 | const std::string& client_id) override; |
dcheng | 440d8e1c | 2014-10-28 01:23:15 | [diff] [blame] | 35 | bool Save(const protocol::PairingRegistry::Pairing& pairing) override; |
36 | bool Delete(const std::string& client_id) override; | ||||
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 37 | |
38 | private: | ||||
39 | FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, SaveAndLoad); | ||||
[email protected] | 37846603 | 2013-08-02 01:35:16 | [diff] [blame] | 40 | FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, Stateless); |
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 41 | |
[email protected] | 37846603 | 2013-08-02 01:35:16 | [diff] [blame] | 42 | // Return the path to the directory to use for loading and saving paired |
43 | // clients. | ||||
44 | base::FilePath GetRegistryPath(); | ||||
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 45 | |
[email protected] | 37846603 | 2013-08-02 01:35:16 | [diff] [blame] | 46 | // For testing purposes, set the path returned by |GetRegistryPath()|. |
47 | void SetRegistryPathForTesting(const base::FilePath& registry_path); | ||||
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 48 | |
[email protected] | 37846603 | 2013-08-02 01:35:16 | [diff] [blame] | 49 | base::FilePath registry_path_for_testing_; |
[email protected] | b1ae901 | 2013-06-23 14:10:30 | [diff] [blame] | 50 | }; |
51 | |||||
52 | } // namespace remoting | ||||
53 | |||||
thestig | a0e18cd | 2015-09-25 04:58:36 | [diff] [blame] | 54 | #endif // REMOTING_HOST_PAIRING_REGISTRY_DELEGATE_LINUX_H_ |