Initial implementation of new protocol API

This commit is contained in:
Cheng Zhao 2015-08-12 13:30:19 +08:00
parent 1e9eaba423
commit 96d53d279e
16 changed files with 345 additions and 743 deletions

View file

@ -12,13 +12,25 @@ namespace atom {
URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& mime_type,
const std::string& charset,
const std::string& data)
: net::URLRequestSimpleJob(request, network_delegate),
mime_type_(mime_type),
charset_(charset),
data_(data) {
v8::Isolate* isolate,
const JavaScriptHandler& handler)
: JsAsker<net::URLRequestSimpleJob>(request, network_delegate, isolate,
handler) {
}
void URLRequestStringJob::StartAsync(scoped_ptr<base::Value> options) {
if (options) {
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_);
dict->GetString("charset", &charset_);
dict->GetString("data", &data_);
} else if (options->IsType(base::Value::TYPE_STRING)) {
options->GetAsString(&data_);
}
}
net::URLRequestSimpleJob::Start();
}
int URLRequestStringJob::GetData(