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

Unified Diff: remoting/host/pairing_registry_delegate_linux.h

Issue 21128006: Refactored PairingRegistry::Delegate such that it can retrieve/modify for a single client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/host/pairing_registry_delegate_linux.h
diff --git a/remoting/host/pairing_registry_delegate_linux.h b/remoting/host/pairing_registry_delegate_linux.h
index 08c073b533ce1078b6b0cabbf0ba5c7ad6541f32..05fae153021d6a760615e6986c984fc063be7d5f 100644
--- a/remoting/host/pairing_registry_delegate_linux.h
+++ b/remoting/host/pairing_registry_delegate_linux.h
@@ -25,43 +25,62 @@ class PairingRegistryDelegateLinux
virtual ~PairingRegistryDelegateLinux();
// PairingRegistry::Delegate interface
- virtual void Save(
- const std::string& pairings_json,
- const protocol::PairingRegistry::SaveCallback& callback) OVERRIDE;
+ virtual void LoadAll(
+ const protocol::PairingRegistry::GetAllPairingsCallback& callback)
+ OVERRIDE;
+ virtual void DeleteAll(
+ const protocol::PairingRegistry::DoneCallback& callback) OVERRIDE;
virtual void Load(
- const protocol::PairingRegistry::LoadCallback& callback) OVERRIDE;
+ const std::string& client_id,
+ const protocol::PairingRegistry::GetPairingCallback& callback) OVERRIDE;
+ virtual void Save(
+ const protocol::PairingRegistry::Pairing& pairing,
+ const protocol::PairingRegistry::DoneCallback& callback) OVERRIDE;
+ virtual void Delete(
+ const std::string& client_id,
+ const protocol::PairingRegistry::DoneCallback& callback) OVERRIDE;
private:
FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, SaveAndLoad);
// Blocking helper methods run using the TaskRunner passed to the ctor.
- void DoSave(const std::string& pairings_json,
- const protocol::PairingRegistry::SaveCallback& callback);
- void DoLoad(const protocol::PairingRegistry::LoadCallback& callback);
+ void DoLoadAll(
+ const protocol::PairingRegistry::GetAllPairingsCallback& callback);
+ void DoDeleteAll(
+ const protocol::PairingRegistry::DoneCallback& callback);
+ void DoLoad(
+ const std::string& client_id,
+ const protocol::PairingRegistry::GetPairingCallback& callback);
+ void DoSave(
+ const protocol::PairingRegistry::Pairing& pairing,
+ const protocol::PairingRegistry::DoneCallback& callback);
+ void DoDelete(
+ const std::string& client_id,
+ const protocol::PairingRegistry::DoneCallback& callback);
// Run the delegate callbacks on their original thread.
- static void RunSaveCallbackOnThread(
+ static void RunDoneCallbackOnThread(
scoped_refptr<base::TaskRunner> task_runner,
- const protocol::PairingRegistry::SaveCallback& callback,
+ const protocol::PairingRegistry::DoneCallback& callback,
bool success);
- static void RunLoadCallbackOnThread(
+ static void RunGetAllPairingsCallbackOnThread(
scoped_refptr<base::TaskRunner> task_runner,
- const protocol::PairingRegistry::LoadCallback& callback,
- const std::string& pairings_json);
-
- // Helper methods to load and save the pairing registry.
- protocol::PairingRegistry::PairedClients LoadPairings();
- void SavePairings(
- const protocol::PairingRegistry::PairedClients& paired_clients);
+ const protocol::PairingRegistry::GetAllPairingsCallback& callback,
+ scoped_ptr<base::ListValue> pairings);
+ static void RunGetPairingCallbackOnThread(
+ scoped_refptr<base::TaskRunner> task_runner,
+ const protocol::PairingRegistry::GetPairingCallback& callback,
+ protocol::PairingRegistry::Pairing pairing);
- // Return the path to the file to use for loading and saving paired clients.
- base::FilePath GetRegistryFilePath();
+ // Return the path to the directory to use for loading and saving paired
+ // clients.
+ base::FilePath GetRegistryPath();
- // For testing purposes, set the path returned by |GetRegistryFilePath|.
- void SetFilenameForTesting(const base::FilePath &filename);
+ // For testing purposes, set the path returned by |GetRegistryPath()|.
+ void SetRegistryPathForTesting(const base::FilePath& registry_path);
scoped_refptr<base::TaskRunner> task_runner_;
- base::FilePath filename_for_testing_;
+ base::FilePath registry_path_for_testing_;
base::WeakPtrFactory<PairingRegistryDelegateLinux> weak_factory_;
« 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