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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/pairing_registry.h
diff --git a/remoting/protocol/pairing_registry.h b/remoting/protocol/pairing_registry.h
index 354452438a046f7d7b7d5a29415ceb370aa1a961..e9bec6f205d96077af92943e5fc9217d673f597e 100644
--- a/remoting/protocol/pairing_registry.h
+++ b/remoting/protocol/pairing_registry.h
@@ -14,6 +14,10 @@
#include "base/threading/non_thread_safe.h"
#include "base/time.h"
+namespace base {
+class TaskRunner;
+} // namespace base
+
namespace remoting {
namespace protocol {
@@ -88,14 +92,20 @@ class PairingRegistry : public base::RefCountedThreadSafe<PairingRegistry>,
explicit PairingRegistry(scoped_ptr<Delegate> delegate);
- // Create a pairing for a new client and save it to disk.
+ // Creates a pairing for a new client and saves it to disk.
Pairing CreatePairing(const std::string& client_name);
- // Get the pairing for the specified client id. See the corresponding
+ // Gets the pairing for the specified client id. See the corresponding
// Delegate method for details.
void GetPairing(const std::string& client_id,
const GetPairingCallback& callback);
+ // Returns a platform-specific Delegate that will save to permanent storage
+ // using the specified TaskRunner. Returns NULL on platforms that don't
+ // support pairing.
+ static scoped_ptr<Delegate> CreateDelegate(
+ scoped_refptr<base::TaskRunner> task_runner);
+
private:
friend class base::RefCountedThreadSafe<PairingRegistry>;
@@ -106,18 +116,6 @@ class PairingRegistry : public base::RefCountedThreadSafe<PairingRegistry>,
DISALLOW_COPY_AND_ASSIGN(PairingRegistry);
};
-// Temporary delegate that just logs NOTIMPLEMENTED for Load/Save.
-// TODO(jamiewalch): Delete once Delegates are implemented for all platforms.
-class NotImplementedPairingRegistryDelegate : public PairingRegistry::Delegate {
- public:
- virtual void AddPairing(
- const PairingRegistry::Pairing& paired_clients,
- const PairingRegistry::AddPairingCallback& callback) OVERRIDE;
- virtual void GetPairing(
- const std::string& client_id,
- const PairingRegistry::GetPairingCallback& callback) OVERRIDE;
-};
-
} // namespace protocol
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698