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