Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: remoting/host/pairing_registry_delegate_linux.h

Issue 15709005: Linux pairing registry delegate implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #include "base/memory/weak_ptr.h"
12
13 namespace base {
14 class ListValue;
15 } // namespace base
16
17 namespace remoting {
18 namespace protocol {
19
20 class PairingRegistryDelegateLinux : public PairingRegistry::Delegate {
21 public:
22 explicit PairingRegistryDelegateLinux(
23 scoped_refptr<base::TaskRunner> task_runner);
24 virtual ~PairingRegistryDelegateLinux();
25
26 // PairingRegistry::Delegate interface
27 virtual void AddPairing(
28 const PairingRegistry::Pairing& new_paired_client,
29 const PairingRegistry::AddPairingCallback& callback) OVERRIDE;
30 virtual void GetPairing(
31 const std::string& client_id,
32 const PairingRegistry::GetPairingCallback& callback) OVERRIDE;
33
34 private:
35 FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, SaveAndLoad);
36
37 // Blocking helper methods run using the TaskRunner passed to the ctor.
38 void DoAddPairing(const PairingRegistry::Pairing& new_paired_client,
39 const PairingRegistry::AddPairingCallback& callback);
40 void DoGetPairing(const std::string& client_id,
41 const PairingRegistry::GetPairingCallback& callback);
42
43 // Run the delegate callbacks on their original thread.
44 void RunAddPairingCallbackOnThread(
45 scoped_refptr<base::TaskRunner> task_runner,
46 const PairingRegistry::AddPairingCallback& callback,
47 bool success);
48 void RunGetPairingCallbackOnThread(
49 scoped_refptr<base::TaskRunner> task_runner,
50 const PairingRegistry::GetPairingCallback& callback,
51 PairingRegistry::Pairing pairing);
52
53 // Helper methods to load and save the pairing registry.
54 PairingRegistry::PairedClients LoadPairings();
55 void SavePairings(const PairingRegistry::PairedClients& paired_clients);
56
57 // Return the path to the file to use for loading and saving paired clients.
58 base::FilePath GetRegistryFilePath();
59
60 // For testing purposes, set the path returned by |GetRegistryFilePath|.
61 void SetFilenameForTesting(const base::FilePath &filename);
62
63 scoped_refptr<base::TaskRunner> task_runner_;
64 base::FilePath filename_for_testing_;
65
66 base::WeakPtrFactory<PairingRegistryDelegateLinux> weak_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(PairingRegistryDelegateLinux);
69 };
70
71 } // namespace protocol
72 } // namespace remoting
73
74 #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/pairing_registry_delegate_linux.cc » ('j') | remoting/host/pairing_registry_delegate_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698