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

Unified Diff: remoting/host/setup/native_messaging_host.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 | « remoting/host/plugin/host_script_object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/native_messaging_host.cc
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc
index 621866746787829024323289dd4fbb9acebfe131..55d002075400f448a25b7506e93be9ab26928333 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;
}
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698