Lines Matching refs: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 {
105 PairingRegistry::Pairing PairingRegistry::CreatePairing(
109 Pairing result = Pairing::Create(client_name);
175 void PairingRegistry::AddPairing(const Pairing& pairing) {
180 &PairingRegistry::DoSave, this, pairing, wrapped_callback);
206 Pairing pairing = delegate_->Load(client_id);
207 PostTask(caller_task_runner_, FROM_HERE, base::Bind(callback, pairing));
211 const protocol::PairingRegistry::Pairing& pairing,
215 bool success = delegate_->Save(pairing);
239 const GetPairingCallback& callback, Pairing pairing) {
240 callback.Run(pairing);
261 LOG(WARNING) << "A pairing entry is not a dictionary.";
265 // Parse the pairing data.
266 Pairing pairing = Pairing::CreateFromValue(*pairing_json);
267 if (!pairing.is_valid()) {
268 LOG(WARNING) << "Could not parse a pairing entry.";
272 // Clear the shared secrect and append the pairing data to the list.
273 Pairing sanitized_pairing(
274 pairing.created_time(),
275 pairing.client_name(),
276 pairing.client_id(),