summaryrefslogtreecommitdiffstats
path: root/remoting/host/setup/native_messaging_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host/setup/native_messaging_host.cc')
-rw-r--r--remoting/host/setup/native_messaging_host.cc31
1 files changed, 22 insertions, 9 deletions
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;
}