summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 10:01:20 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 10:01:20 +0000
commitf0b1f65341802ddb393fdc1c7b16ed2eb6971209 (patch)
treee347df6c4576c3e3dc05f7920e899d8efd1452ba /remoting
parentb156a9567aa3cf22d6f7383236b71ca33fb1fdd7 (diff)
downloadchromium_src-f0b1f65341802ddb393fdc1c7b16ed2eb6971209.zip
chromium_src-f0b1f65341802ddb393fdc1c7b16ed2eb6971209.tar.gz
chromium_src-f0b1f65341802ddb393fdc1c7b16ed2eb6971209.tar.bz2
Fix NPAPI and native messaging hosts to cope with NULL pairing registry.
Since there are no Windows or Mac pairing registry delegates yet, the host plugin currently crashes when the web-app starts up on those platforms. Review URL: https://chromiumcodereview.appspot.com/19460020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/plugin/host_script_object.cc33
-rw-r--r--remoting/host/setup/native_messaging_host.cc31
2 files changed, 45 insertions, 19 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 8c03d8f..9b78eb3 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;
}
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc
index 6218667..55d0020 100644
--- a/remoting/host/setup/native_messaging_host.cc
+++ b/remoting/host/setup/native_messaging_host.cc
@@ -150,9 +150,13 @@ bool NativeMessagingHost::ProcessHello(
bool NativeMessagingHost::ProcessClearPairedClients(
const base::DictionaryValue& message,
scoped_ptr<base::DictionaryValue> response) {
- pairing_registry_->ClearAllPairings(
- base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
- base::Passed(&response)));
+ if (pairing_registry_) {
+ pairing_registry_->ClearAllPairings(
+ base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
+ base::Passed(&response)));
+ } else {
+ SendBooleanResult(response.Pass(), false);
+ }
return true;
}
@@ -166,9 +170,13 @@ bool NativeMessagingHost::ProcessDeletePairedClient(
return false;
}
- pairing_registry_->DeletePairing(
- client_id, base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
- base::Passed(&response)));
+ if (pairing_registry_) {
+ pairing_registry_->DeletePairing(
+ client_id, base::Bind(&NativeMessagingHost::SendBooleanResult,
+ weak_ptr_, base::Passed(&response)));
+ } else {
+ SendBooleanResult(response.Pass(), false);
+ }
return true;
}
@@ -237,9 +245,14 @@ bool NativeMessagingHost::ProcessGetDaemonConfig(
bool NativeMessagingHost::ProcessGetPairedClients(
const base::DictionaryValue& message,
scoped_ptr<base::DictionaryValue> response) {
- pairing_registry_->GetAllPairings(
- base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_,
- base::Passed(&response)));
+ if (pairing_registry_) {
+ pairing_registry_->GetAllPairings(
+ base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_,
+ base::Passed(&response)));
+ } else {
+ scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue);
+ SendPairedClientsResponse(response.Pass(), no_paired_clients.Pass());
+ }
return true;
}