return;
} else if (name == "RequestHttpJob") {
GURL url;
- std::string method;
+ std::string method, referrer;
dict.Get("url", &url);
dict.Get("method", &method);
+ dict.Get("referrer", &referrer);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&AdapterRequestJob::CreateHttpJobAndStart,
- GetWeakPtr(), url, method));
+ GetWeakPtr(), url, method, referrer));
return;
}
}
protocol.RequestHttpJob =
class RequestHttpJob
- constructor: ({@url, @method}) ->
+ constructor: ({@url, @method, @referrer}) ->
module.exports = protocol
}
void AdapterRequestJob::CreateHttpJobAndStart(const GURL& url,
- const std::string& method) {
+ const std::string& method,
+ const std::string& referrer) {
if (!url.is_valid()) {
CreateErrorJobAndStart(net::ERR_INVALID_URL);
return;
}
real_job_ = new URLRequestFetchJob(request(), network_delegate(), url,
- method);
+ method, referrer);
real_job_->Start();
}
const std::string& charset,
scoped_refptr<base::RefCountedBytes> data);
void CreateFileJobAndStart(const base::FilePath& path);
- void CreateHttpJobAndStart(const GURL& url, const std::string& method);
+ void CreateHttpJobAndStart(const GURL& url,
+ const std::string& method,
+ const std::string& referrer);
void CreateJobFromProtocolHandlerAndStart();
private:
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const GURL& url,
- const std::string& method)
+ const std::string& method,
+ const std::string& referrer)
: net::URLRequestJob(request, network_delegate),
pending_buffer_size_(0) {
// Use |request|'s method if |method| is not specified.
auto context = AtomBrowserContext::Get()->url_request_context_getter();
fetcher_->SetRequestContext(context);
fetcher_->SaveResponseWithWriter(make_scoped_ptr(new ResponsePiper(this)));
+
+ // Use |request|'s referrer if |referrer| is not specified.
+ if (referrer.empty())
+ fetcher_->SetReferrer(request->referrer());
+ else
+ fetcher_->SetReferrer(referrer);
}
void URLRequestFetchJob::HeadersCompleted() {
URLRequestFetchJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const GURL& url,
- const std::string& method);
+ const std::string& method,
+ const std::string& referrer);
void HeadersCompleted();
int DataAvailable(net::IOBuffer* buffer, int num_bytes);