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

Unified Diff: remoting/protocol/pairing_registry.cc

Issue 16893002: Make the mapping from client id -> secret asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. 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
« no previous file with comments | « remoting/protocol/pairing_registry.h ('k') | remoting/protocol/pairing_registry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pairing_registry.cc
diff --git a/remoting/protocol/pairing_registry.cc b/remoting/protocol/pairing_registry.cc
index 54b66b04b79996bc335423cbaddb200755f9b6c5..10098b03ed74850a820670e1f9b5646a2d68caec 100644
--- a/remoting/protocol/pairing_registry.cc
+++ b/remoting/protocol/pairing_registry.cc
@@ -15,17 +15,15 @@ namespace protocol {
// How many bytes of random data to use for the client id and shared secret.
const int kKeySize = 16;
-PairingRegistry::PairingRegistry(scoped_ptr<Delegate> delegate,
- const PairedClients& paired_clients)
+PairingRegistry::PairingRegistry(scoped_ptr<Delegate> delegate)
: delegate_(delegate.Pass()) {
DCHECK(delegate_);
- paired_clients_ = paired_clients;
}
PairingRegistry::~PairingRegistry() {
}
-const PairingRegistry::Pairing& PairingRegistry::CreatePairing(
+PairingRegistry::Pairing PairingRegistry::CreatePairing(
const std::string& client_name) {
DCHECK(CalledOnValidThread());
@@ -42,27 +40,28 @@ const PairingRegistry::Pairing& PairingRegistry::CreatePairing(
}
// Save the result via the Delegate and return it to the caller.
- paired_clients_[result.client_id] = result;
- delegate_->Save(paired_clients_);
-
- return paired_clients_[result.client_id];
+ delegate_->AddPairing(result);
+ return result;
}
-std::string PairingRegistry::GetSecret(const std::string& client_id) const {
+void PairingRegistry::GetPairing(const std::string& client_id,
+ const GetPairingCallback& callback) {
DCHECK(CalledOnValidThread());
+ delegate_->GetPairing(client_id, callback);
+}
- std::string result;
- PairedClients::const_iterator i = paired_clients_.find(client_id);
- if (i != paired_clients_.end()) {
- result = i->second.shared_secret;
- }
- return result;
+void NotImplementedPairingRegistryDelegate::AddPairing(
+ const PairingRegistry::Pairing& new_paired_client) {
+ NOTIMPLEMENTED();
}
-void NotImplementedPairingRegistryDelegate::Save(
- const PairingRegistry::PairedClients& paired_clients) {
+void NotImplementedPairingRegistryDelegate::GetPairing(
+ const std::string& client_id,
+ const PairingRegistry::GetPairingCallback& callback) {
NOTIMPLEMENTED();
+ callback.Run(PairingRegistry::Pairing());
}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/pairing_registry.h ('k') | remoting/protocol/pairing_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698