2015-10-31 13:39:07 +00:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#ifndef SHELL_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_
|
|
|
|
#define SHELL_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_
|
2015-10-31 13:39:07 +00:00
|
|
|
|
2015-11-05 14:06:36 +00:00
|
|
|
#include "base/memory/ref_counted.h"
|
2015-10-31 13:39:07 +00:00
|
|
|
#include "native_mate/converter.h"
|
|
|
|
|
2016-01-26 08:28:21 +00:00
|
|
|
namespace base {
|
2016-06-08 13:52:21 +00:00
|
|
|
class DictionaryValue;
|
2016-01-26 08:28:21 +00:00
|
|
|
class ListValue;
|
2018-04-18 01:44:10 +00:00
|
|
|
} // namespace base
|
2016-01-26 08:28:21 +00:00
|
|
|
|
2015-10-31 13:39:07 +00:00
|
|
|
namespace net {
|
|
|
|
class AuthChallengeInfo;
|
|
|
|
class URLRequest;
|
2015-11-05 14:06:36 +00:00
|
|
|
class X509Certificate;
|
2016-10-13 15:14:23 +00:00
|
|
|
class HttpResponseHeaders;
|
2016-11-09 17:19:35 +00:00
|
|
|
struct CertPrincipal;
|
2018-04-18 01:44:10 +00:00
|
|
|
} // namespace net
|
2015-10-31 13:39:07 +00:00
|
|
|
|
2019-04-29 02:37:45 +00:00
|
|
|
namespace network {
|
|
|
|
struct ResourceRequest;
|
|
|
|
}
|
|
|
|
|
2015-10-31 13:39:07 +00:00
|
|
|
namespace mate {
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2019-04-20 17:20:37 +00:00
|
|
|
struct Converter<net::AuthChallengeInfo> {
|
2015-10-31 13:39:07 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
2019-04-20 17:20:37 +00:00
|
|
|
const net::AuthChallengeInfo& val);
|
2015-10-31 13:39:07 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2015-11-05 14:06:36 +00:00
|
|
|
struct Converter<scoped_refptr<net::X509Certificate>> {
|
2018-04-18 01:44:10 +00:00
|
|
|
static v8::Local<v8::Value> ToV8(
|
|
|
|
v8::Isolate* isolate,
|
2015-11-05 14:06:36 +00:00
|
|
|
const scoped_refptr<net::X509Certificate>& val);
|
2017-03-31 17:53:31 +00:00
|
|
|
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
scoped_refptr<net::X509Certificate>* out);
|
2015-11-05 14:06:36 +00:00
|
|
|
};
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
template <>
|
2016-11-09 17:19:35 +00:00
|
|
|
struct Converter<net::CertPrincipal> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const net::CertPrincipal& val);
|
|
|
|
};
|
|
|
|
|
2016-10-25 10:41:01 +00:00
|
|
|
template <>
|
|
|
|
struct Converter<net::HttpResponseHeaders*> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
net::HttpResponseHeaders* headers);
|
2017-11-03 17:46:49 +00:00
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
net::HttpResponseHeaders* out);
|
2016-10-13 15:14:23 +00:00
|
|
|
};
|
|
|
|
|
2019-04-29 02:37:45 +00:00
|
|
|
template <>
|
|
|
|
struct Converter<network::ResourceRequest> {
|
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
|
const network::ResourceRequest& val);
|
|
|
|
};
|
|
|
|
|
2015-10-31 13:39:07 +00:00
|
|
|
} // namespace mate
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2016-01-26 08:28:21 +00:00
|
|
|
|
2016-06-08 13:52:21 +00:00
|
|
|
void FillRequestDetails(base::DictionaryValue* details,
|
|
|
|
const net::URLRequest* request);
|
|
|
|
|
2016-01-26 08:28:21 +00:00
|
|
|
void GetUploadData(base::ListValue* upload_data_list,
|
|
|
|
const net::URLRequest* request);
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2016-01-26 08:28:21 +00:00
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#endif // SHELL_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_
|