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

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 19460020: Fix NPAPI and native messaging hosts to cope with NULL pairing registry. (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
« no previous file with comments | « no previous file | remoting/host/setup/native_messaging_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 8c03d8ffa362ea040e6fd30eb3af7e74d60fcb3e..9b78eb3ea63e4d246963f2559e832cd4fa1b1864 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -1111,9 +1111,13 @@ bool HostNPScriptObject::ClearPairedClients(const NPVariant* args,
}
ScopedRefNPObject callback_obj(ObjectFromNPVariant(args[0]));
- pairing_registry_->ClearAllPairings(
- base::Bind(&HostNPScriptObject::InvokeBooleanCallback, weak_ptr_,
- callback_obj));
+ if (pairing_registry_) {
+ pairing_registry_->ClearAllPairings(
+ base::Bind(&HostNPScriptObject::InvokeBooleanCallback, weak_ptr_,
+ callback_obj));
+ } else {
+ InvokeBooleanCallback(callback_obj, false);
+ }
return true;
}
@@ -1138,10 +1142,14 @@ bool HostNPScriptObject::DeletePairedClient(const NPVariant* args,
std::string client_id = StringFromNPVariant(args[0]);
ScopedRefNPObject callback_obj(ObjectFromNPVariant(args[1]));
- pairing_registry_->DeletePairing(
- client_id,
- base::Bind(&HostNPScriptObject::InvokeBooleanCallback,
- weak_ptr_, callback_obj));
+ if (pairing_registry_) {
+ pairing_registry_->DeletePairing(
+ client_id,
+ base::Bind(&HostNPScriptObject::InvokeBooleanCallback,
+ weak_ptr_, callback_obj));
+ } else {
+ InvokeBooleanCallback(callback_obj, false);
+ }
return true;
}
@@ -1325,9 +1333,14 @@ bool HostNPScriptObject::GetPairedClients(const NPVariant* args,
return false;
}
- pairing_registry_->GetAllPairings(
- base::Bind(&HostNPScriptObject::InvokeGetPairedClientsCallback,
- weak_ptr_, callback_obj));
+ if (pairing_registry_) {
+ pairing_registry_->GetAllPairings(
+ base::Bind(&HostNPScriptObject::InvokeGetPairedClientsCallback,
+ weak_ptr_, callback_obj));
+ } else {
+ scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue);
+ InvokeGetPairedClientsCallback(callback_obj, no_paired_clients.Pass());
+ }
return true;
}
« no previous file with comments | « no previous file | remoting/host/setup/native_messaging_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698