|
@@ -2,8 +2,6 @@
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
-#include "shell/browser/api/electron_api_net.h"
|
|
|
-
|
|
|
#include <string>
|
|
|
|
|
|
#include "gin/handle.h"
|
|
@@ -14,31 +12,6 @@
|
|
|
|
|
|
#include "shell/common/node_includes.h"
|
|
|
|
|
|
-namespace electron {
|
|
|
-
|
|
|
-namespace api {
|
|
|
-
|
|
|
-Net::Net(v8::Isolate* isolate) {
|
|
|
- Init(isolate);
|
|
|
-}
|
|
|
-
|
|
|
-Net::~Net() = default;
|
|
|
-
|
|
|
-// static
|
|
|
-v8::Local<v8::Value> Net::Create(v8::Isolate* isolate) {
|
|
|
- return gin::CreateHandle(isolate, new Net(isolate)).ToV8();
|
|
|
-}
|
|
|
-
|
|
|
-// static
|
|
|
-void Net::BuildPrototype(v8::Isolate* isolate,
|
|
|
- v8::Local<v8::FunctionTemplate> prototype) {
|
|
|
- prototype->SetClassName(gin::StringToV8(isolate, "Net"));
|
|
|
-}
|
|
|
-
|
|
|
-} // namespace api
|
|
|
-
|
|
|
-} // namespace electron
|
|
|
-
|
|
|
namespace {
|
|
|
|
|
|
bool IsValidHeaderName(std::string header_name) {
|
|
@@ -49,7 +22,6 @@ bool IsValidHeaderValue(std::string header_value) {
|
|
|
return net::HttpUtil::IsValidHeaderValue(header_value);
|
|
|
}
|
|
|
|
|
|
-using electron::api::Net;
|
|
|
using electron::api::SimpleURLLoaderWrapper;
|
|
|
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
@@ -59,9 +31,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
|
|
v8::Isolate* isolate = context->GetIsolate();
|
|
|
|
|
|
gin_helper::Dictionary dict(isolate, exports);
|
|
|
- dict.Set("net", Net::Create(isolate));
|
|
|
- dict.Set("Net",
|
|
|
- Net::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());
|
|
|
dict.SetMethod("isValidHeaderName", &IsValidHeaderName);
|
|
|
dict.SetMethod("isValidHeaderValue", &IsValidHeaderValue);
|
|
|
dict.SetMethod("createURLLoader", &SimpleURLLoaderWrapper::Create);
|