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

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: Created 7 years, 7 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
« no previous file with comments | « remoting/host/pairing_registry_delegate_linux_unittest.cc ('k') | remoting/protocol/pairing_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pairing_registry.h
diff --git a/remoting/protocol/pairing_registry.h b/remoting/protocol/pairing_registry.h
index 48893561e8ae14a3220fe061e015aee557bf300c..4a9769ab41917d2965750de8e7e04ce56ddcafcd 100644
--- a/remoting/protocol/pairing_registry.h
+++ b/remoting/protocol/pairing_registry.h
@@ -12,6 +12,11 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/threading/non_thread_safe.h"
+#include "base/time.h"
+
+namespace base {
+class TaskRunner;
+} // namespace base
namespace remoting {
namespace protocol {
@@ -29,6 +34,9 @@ class PairingRegistry : public base::RefCountedThreadSafe<PairingRegistry>,
public base::NonThreadSafe {
public:
struct Pairing {
+ bool operator==(const Pairing& other) const;
+
+ base::Time created_time;
Jamie 2013/05/31 01:14:22 Not strictly related to this CL, and I'm not sure
std::string client_id;
std::string client_name;
std::string shared_secret;
@@ -44,6 +52,14 @@ class PairingRegistry : public base::RefCountedThreadSafe<PairingRegistry>,
// Save pairing information to persistent storage. Must not block.
virtual void Save(const PairedClients& paired_clients) = 0;
+
+ // Load the pairing information synchronously from persistent storage.
+ // Note that this method is not used by the PairingRegistry class; instead
+ // it should be called on the result of CreateDelegate prior to creating
+ // a PairingRegistry. Unlike Save, LoadOnCurrentThread may block while
+ // loading the pairings--it is the caller's responsibility to make sure
+ // it is called on a suitable thread.
+ virtual PairedClients LoadOnCurrentThread() = 0;
};
explicit PairingRegistry(scoped_ptr<Delegate> delegate,
@@ -56,6 +72,12 @@ class PairingRegistry : public base::RefCountedThreadSafe<PairingRegistry>,
// string if the client id is not known.
std::string GetSecret(const std::string &client_id) const;
+ // Return a platform-specific Delegate that will save to permanent storage
+ // using the specified TaskRunner. Return 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>;
@@ -77,6 +99,7 @@ class NotImplementedPairingRegistryDelegate : public PairingRegistry::Delegate {
public:
virtual void Save(
const PairingRegistry::PairedClients& paired_clients) OVERRIDE;
+ virtual PairingRegistry::PairedClients LoadOnCurrentThread() OVERRIDE;
};
} // namespace protocol
« no previous file with comments | « remoting/host/pairing_registry_delegate_linux_unittest.cc ('k') | remoting/protocol/pairing_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698