#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/media/media_stream_devices_controller.h"
#include "native_mate/callback.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
+#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context.h"
#include "atom/common/node_includes.h"
void WebContents::DidGetResourceResponseStart(
const content::ResourceRequestDetails& details) {
+ net::HttpResponseHeaders* headers = details.headers.get();
+ base::DictionaryValue response_headers;
+ void* iter = nullptr;
+ std::string key;
+ std::string value;
+ while (headers && headers->EnumerateHeaderLines(&iter, &key, &value)) {
+ response_headers.SetString(base::StringToLowerASCII(key),
+ base::StringToLowerASCII(value));
+ }
Emit("did-get-response-details",
details.socket_address.IsEmpty(),
details.url,
details.http_response_code,
details.method,
details.referrer,
- details.header);
+ response_headers);
}
void WebContents::DidGetRedirectForResourceRequest(
}
}
+v8::Handle<v8::Value> Converter<base::DictionaryValue>::ToV8(
+ v8::Isolate* isolate,
+ const base::DictionaryValue& val) {
+ scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
+ return converter->ToV8Value(&val, isolate->GetCurrentContext());
+}
+
bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::ListValue* out) {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::DictionaryValue* out);
+ static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
+ const base::DictionaryValue& val);
};
template<>
* `httpResponseCode` Integer
* `requestMethod` String
* `referrer` String
-* `headers` String
+* `headers` Object
Emitted when details regarding a requested resource is available.
`status` indicates the socket connection to download the resource.
-`headers` is key-value string separated by new-line character.
### Event: 'did-get-redirect-request'
* `httpResponseCode` Integer
* `requestMethod` String
* `referrer` String
-* `headers` String
+* `headers` Object
Fired when details regarding a requested resource is available.
`status` indicates socket connection to download the resource.
-`headers` is key-value string separated by new-line character.
### did-get-redirect-request