electron/atom/browser/net/url_request_buffer_job.cc

37 lines
949 B
C++
Raw Normal View History

2015-03-16 12:53:45 +00:00
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/browser/net/url_request_buffer_job.h"
#include <string>
#include "net/base/net_errors.h"
namespace atom {
2015-05-22 14:15:13 +00:00
URLRequestBufferJob::URLRequestBufferJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
const std::string& mime_type,
const std::string& charset,
scoped_refptr<base::RefCountedBytes> data)
2015-03-16 12:53:45 +00:00
: net::URLRequestSimpleJob(request, network_delegate),
mime_type_(mime_type),
charset_(charset),
2015-05-22 14:15:13 +00:00
buffer_data_(data) {
2015-03-16 12:53:45 +00:00
}
int URLRequestBufferJob::GetRefCountedData(
std::string* mime_type,
std::string* charset,
scoped_refptr<base::RefCountedMemory>* data,
const net::CompletionCallback& callback) const {
*mime_type = mime_type_;
*charset = charset_;
*data = buffer_data_;
return net::OK;
}
} // namespace atom