chore: remove native_mate (Part 5) (#20264)

* deprecate native_mate/native_mate/object_template_builder.h

* add gin_helper/object_template_builder.h

* add patch to avoid ambiguous error

* remove usage of object_template_builder_deprecated.h in a few files

* add note we should remove gin_helper/object_template_builder.h in future
This commit is contained in:
Cheng Zhao 2019-09-19 11:09:15 -04:00 committed by Shelley Vohr
parent 63f08fcdb0
commit 624ba4f642
39 changed files with 474 additions and 121 deletions

View file

@ -10,8 +10,9 @@
#include <string>
#include <vector>
#include "gin/arguments.h"
#include "gin/dictionary.h"
#include "mojo/public/cpp/system/data_pipe_producer.h"
#include "native_mate/dictionary.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
@ -47,7 +48,7 @@ class URLRequestNS : public mate::EventEmitter<URLRequestNS>,
bool SetExtraHeader(const std::string& name, const std::string& value);
void RemoveExtraHeader(const std::string& name);
void SetChunkedUpload(bool is_chunked_upload);
mate::Dictionary GetUploadProgress();
gin::Dictionary GetUploadProgress();
int StatusCode() const;
std::string StatusMessage() const;
net::HttpResponseHeaders* RawResponseHeaders() const;
@ -140,4 +141,22 @@ class URLRequestNS : public mate::EventEmitter<URLRequestNS>,
} // namespace electron
namespace gin {
// TODO(zcbenz): Remove this after converting URLRequestNS to gin::Wrapper.
template <>
struct Converter<electron::api::URLRequestNS*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::api::URLRequestNS** out) {
return mate::ConvertFromV8(isolate, val, out);
}
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
electron::api::URLRequestNS* in) {
return mate::ConvertToV8(isolate, in);
}
};
} // namespace gin
#endif // SHELL_BROWSER_API_ATOM_API_URL_REQUEST_NS_H_