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

Unified Diff: chrome/browser/extensions/api/api_resource_event_notifier.cc

Issue 10095020: Allow socket API to send binary data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Set 1 Created 8 years, 8 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
Index: chrome/browser/extensions/api/api_resource_event_notifier.cc
diff --git a/chrome/browser/extensions/api/api_resource_event_notifier.cc b/chrome/browser/extensions/api/api_resource_event_notifier.cc
index 8a157e9fa7b2aa2f6481af5f5e6b23dcae64a529..6b090239e6406c9a3b2309c263aadb82d814d772 100644
--- a/chrome/browser/extensions/api/api_resource_event_notifier.cc
+++ b/chrome/browser/extensions/api/api_resource_event_notifier.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/json/json_writer.h"
+#include "base/values.h"
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
@@ -50,18 +51,20 @@ void APIResourceEventNotifier::OnConnectComplete(int result_code) {
}
void APIResourceEventNotifier::OnDataRead(int result_code,
- const std::string& data) {
+ base::ListValue* data) {
// Do we have a destination for this event? There will be one if a source id
// was injected by the request handler for the resource's create method in
// schema_generated_bindings.js, which will in turn be the case if the caller
// of the create method provided an onEvent closure.
- if (src_id_ < 0)
+ if (src_id_ < 0) {
+ delete data;
return;
+ }
DictionaryValue* event = CreateAPIResourceEvent(
API_RESOURCE_EVENT_DATA_READ);
event->SetInteger(kResultCodeKey, result_code);
- event->SetString(kDataKey, data);
+ event->Set(kDataKey, data);
DispatchEvent(event);
}

Powered by Google App Engine
This is Rietveld 408576698