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

Side by Side Diff: remoting/protocol/pairing_registry.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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_PAIRING_REGISTRY_H_ 5 #ifndef REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
6 #define REMOTING_PROTOCOL_PAIRING_REGISTRY_H_ 6 #define REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const AddPairingCallback& callback) = 0; 81 const AddPairingCallback& callback) = 0;
82 82
83 // Retrieve the Pairing for the specified client id. If none is found, 83 // Retrieve the Pairing for the specified client id. If none is found,
84 // invoke the callback with a default pairing. Must not block. 84 // invoke the callback with a default pairing. Must not block.
85 virtual void GetPairing(const std::string& client_id, 85 virtual void GetPairing(const std::string& client_id,
86 const GetPairingCallback& callback) = 0; 86 const GetPairingCallback& callback) = 0;
87 }; 87 };
88 88
89 explicit PairingRegistry(scoped_ptr<Delegate> delegate); 89 explicit PairingRegistry(scoped_ptr<Delegate> delegate);
90 90
91 // Create a pairing for a new client and save it to disk. 91 // Creates a pairing for a new client and saves it to disk.
92 Pairing CreatePairing(const std::string& client_name); 92 Pairing CreatePairing(const std::string& client_name);
93 93
94 // Get the pairing for the specified client id. See the corresponding 94 // Gets the pairing for the specified client id. See the corresponding
95 // Delegate method for details. 95 // Delegate method for details.
96 void GetPairing(const std::string& client_id, 96 void GetPairing(const std::string& client_id,
97 const GetPairingCallback& callback); 97 const GetPairingCallback& callback);
98 98
99 private: 99 private:
100 friend class base::RefCountedThreadSafe<PairingRegistry>; 100 friend class base::RefCountedThreadSafe<PairingRegistry>;
101 101
102 virtual ~PairingRegistry(); 102 virtual ~PairingRegistry();
103 103
104 scoped_ptr<Delegate> delegate_; 104 scoped_ptr<Delegate> delegate_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(PairingRegistry); 106 DISALLOW_COPY_AND_ASSIGN(PairingRegistry);
107 }; 107 };
108 108
109 // Temporary delegate that just logs NOTIMPLEMENTED for Load/Save.
110 // TODO(jamiewalch): Delete once Delegates are implemented for all platforms.
111 class NotImplementedPairingRegistryDelegate : public PairingRegistry::Delegate {
112 public:
113 virtual void AddPairing(
114 const PairingRegistry::Pairing& paired_clients,
115 const PairingRegistry::AddPairingCallback& callback) OVERRIDE;
116 virtual void GetPairing(
117 const std::string& client_id,
118 const PairingRegistry::GetPairingCallback& callback) OVERRIDE;
119 };
120
121 } // namespace protocol 109 } // namespace protocol
122 } // namespace remoting 110 } // namespace remoting
123 111
124 #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_H_ 112 #endif // REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698