2015-03-16 18:23:45 +05:30
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 13:56:58 -07:00
|
|
|
#ifndef SHELL_BROWSER_NET_URL_REQUEST_BUFFER_JOB_H_
|
|
|
|
#define SHELL_BROWSER_NET_URL_REQUEST_BUFFER_JOB_H_
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2018-09-12 19:25:56 -05:00
|
|
|
#include <memory>
|
2015-03-16 18:23:45 +05:30
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/memory/ref_counted_memory.h"
|
2015-09-15 19:54:16 +05:30
|
|
|
#include "net/http/http_status_code.h"
|
2015-03-16 18:23:45 +05:30
|
|
|
#include "net/url_request/url_request_simple_job.h"
|
2019-06-19 13:46:59 -07:00
|
|
|
#include "shell/browser/net/js_asker.h"
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2018-10-06 01:59:57 +05:30
|
|
|
class URLRequestBufferJob : public JsAsker, public net::URLRequestSimpleJob {
|
2015-03-16 18:23:45 +05:30
|
|
|
public:
|
2015-08-12 22:57:25 +08:00
|
|
|
URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*);
|
2018-04-17 16:37:22 -07:00
|
|
|
~URLRequestBufferJob() override;
|
2015-08-12 20:37:52 +08:00
|
|
|
|
2018-10-06 01:59:57 +05:30
|
|
|
void StartAsync(std::unique_ptr<base::Value> options, int error);
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2015-09-15 19:54:16 +05:30
|
|
|
// URLRequestJob:
|
2018-10-06 01:59:57 +05:30
|
|
|
void Start() override;
|
2015-09-15 19:54:16 +05:30
|
|
|
void GetResponseInfo(net::HttpResponseInfo* info) override;
|
2018-10-06 01:59:57 +05:30
|
|
|
void Kill() override;
|
2015-09-15 19:54:16 +05:30
|
|
|
|
2015-03-16 18:23:45 +05:30
|
|
|
// URLRequestSimpleJob:
|
|
|
|
int GetRefCountedData(std::string* mime_type,
|
|
|
|
std::string* charset,
|
|
|
|
scoped_refptr<base::RefCountedMemory>* data,
|
2018-10-25 20:50:55 +05:30
|
|
|
net::CompletionOnceCallback callback) const override;
|
2015-03-16 18:23:45 +05:30
|
|
|
|
|
|
|
private:
|
|
|
|
std::string mime_type_;
|
|
|
|
std::string charset_;
|
2015-08-12 20:37:52 +08:00
|
|
|
scoped_refptr<base::RefCountedBytes> data_;
|
2015-09-15 19:54:16 +05:30
|
|
|
net::HttpStatusCode status_code_;
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2018-10-06 01:59:57 +05:30
|
|
|
base::WeakPtrFactory<URLRequestBufferJob> weak_factory_;
|
|
|
|
|
2015-03-16 18:23:45 +05:30
|
|
|
DISALLOW_COPY_AND_ASSIGN(URLRequestBufferJob);
|
|
|
|
};
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|
2015-03-16 18:23:45 +05:30
|
|
|
|
2019-06-19 13:56:58 -07:00
|
|
|
#endif // SHELL_BROWSER_NET_URL_REQUEST_BUFFER_JOB_H_
|