Lines Matching defs:pairing
29 PairingRegistry::Pairing::Pairing() {
32 PairingRegistry::Pairing::Pairing(const base::Time& created_time,
42 PairingRegistry::Pairing::~Pairing() {
45 PairingRegistry::Pairing PairingRegistry::Pairing::Create(
54 return Pairing(created_time, client_name, client_id, shared_secret);
57 PairingRegistry::Pairing PairingRegistry::Pairing::CreateFromValue(
58 const base::DictionaryValue& pairing) {
61 if (pairing.GetDouble(kCreatedTimeKey, &created_time_value) &&
62 pairing.GetString(kClientNameKey, &client_name) &&
63 pairing.GetString(kClientIdKey, &client_id)) {
66 pairing.GetString(kSharedSecretKey, &shared_secret);
68 return Pairing(created_time, client_name, client_id, shared_secret);
71 LOG(ERROR) << "Failed to load pairing information: unexpected format.";
72 return Pairing();
75 scoped_ptr<base::DictionaryValue> PairingRegistry::Pairing::ToValue() const {
76 scoped_ptr<base::DictionaryValue> pairing(new base::DictionaryValue());
77 pairing->SetDouble(kCreatedTimeKey, created_time().ToJsTime());
78 pairing->SetString(kClientNameKey, client_name());
79 pairing->SetString(kClientIdKey, client_id());
81 pairing->SetString(kSharedSecretKey, shared_secret());
82 return pairing.Pass();
85 bool PairingRegistry::Pairing::operator==(const Pairing& other) const {
92 bool PairingRegistry::Pairing::is_valid() const {
107 PairingRegistry::Pairing PairingRegistry::CreatePairing(
111 Pairing result = Pairing::Create(client_name);
177 void PairingRegistry::AddPairing(const Pairing& pairing) {
182 &PairingRegistry::DoSave, this, pairing, wrapped_callback);
208 Pairing pairing = delegate_->Load(client_id);
209 PostTask(caller_task_runner_, FROM_HERE, base::Bind(callback, pairing));
213 const protocol::PairingRegistry::Pairing& pairing,
217 bool success = delegate_->Save(pairing);
241 const GetPairingCallback& callback, Pairing pairing) {
242 callback.Run(pairing);
263 LOG(WARNING) << "A pairing entry is not a dictionary.";
267 // Parse the pairing data.
268 Pairing pairing = Pairing::CreateFromValue(*pairing_json);
269 if (!pairing.is_valid()) {
270 LOG(WARNING) << "Could not parse a pairing entry.";
274 // Clear the shared secrect and append the pairing data to the list.
275 Pairing sanitized_pairing(
276 pairing.created_time(),
277 pairing.client_name(),
278 pairing.client_id(),