#include "browser/api/atom_api_protocol.h"
+#include "base/memory/weak_ptr.h"
#include "browser/atom_browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "net/url_request/url_request_context.h"
public:
AdapterRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate)
- : URLRequestJob(request, network_delegate) {}
+ : URLRequestJob(request, network_delegate),
+ weak_factory_(this) {
+ }
protected:
virtual void Start() OVERRIDE {
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
- base::Bind(&AdapterRequestJob::GetJobTypeInUI, base::Unretained(this)));
+ base::Bind(&AdapterRequestJob::GetJobTypeInUI,
+ weak_factory_.GetWeakPtr()));
}
virtual void Kill() OVERRIDE {
// Determine the type of the job we are going to create.
if (result->IsString()) {
type_ = STRING_JOB;
- string_ = *v8::String::Utf8Value(result);
+ data_ = *v8::String::Utf8Value(result);
} else {
type_ = ERROR_JOB;
- error_code_ = ERR_NOT_IMPLEMENTED;
+ error_code_ = net::ERR_NOT_IMPLEMENTED;
}
// Go back to the IO thread.
content::BrowserThread::IO,
FROM_HERE,
base::Bind(&AdapterRequestJob::CreateJobAndStart,
- base::Unretained(this)));
+ weak_factory_.GetWeakPtr()));
}
void CreateJobAndStart() {
JOB_TYPE type_;
int error_code_;
- std::string string_;
base::FilePath file_path_;
+ std::string mime_type_;
+ std::string charset_;
+ std::string data_;
+
+ base::WeakPtrFactory<AdapterRequestJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AdapterRequestJob);
};