chore: remove native_mate (Part 7) (#20561)

* refactor: use gin converters in api::Protocol

* refactor: convert JS constructor impl to gin

* refactor: use InitWithArgs helper

* fix: gin_helper::Dictionary should behave the same with mate

* fix cpplint warnings

* refactor: no more need to patch gin/dictionary.h
This commit is contained in:
Cheng Zhao 2019-10-15 10:15:23 +09:00 committed by GitHub
parent 6c6bff81ac
commit 1ecfcc8c70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 274 additions and 368 deletions

View file

@ -10,10 +10,10 @@
#include <utility>
#include "mojo/public/cpp/bindings/binding_set.h"
#include "native_mate/dictionary.h"
#include "net/url_request/url_request_job_factory.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "shell/common/gin_helper/dictionary.h"
namespace electron {
@ -27,7 +27,7 @@ enum class ProtocolType {
kFree, // special type for returning arbitrary type of response.
};
using StartLoadingCallback = base::OnceCallback<void(mate::Arguments*)>;
using StartLoadingCallback = base::OnceCallback<void(gin::Arguments*)>;
using ProtocolHandler =
base::Callback<void(const network::ResourceRequest&, StartLoadingCallback)>;
@ -62,22 +62,22 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
network::mojom::URLLoaderFactory* proxy_factory,
ProtocolType type,
mate::Arguments* args);
gin::Arguments* args);
private:
static void StartLoadingBuffer(network::mojom::URLLoaderClientPtr client,
network::ResourceResponseHead head,
const mate::Dictionary& dict);
const gin_helper::Dictionary& dict);
static void StartLoadingString(network::mojom::URLLoaderClientPtr client,
network::ResourceResponseHead head,
const mate::Dictionary& dict,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
static void StartLoadingFile(network::mojom::URLLoaderRequest loader,
network::ResourceRequest request,
network::mojom::URLLoaderClientPtr client,
network::ResourceResponseHead head,
const mate::Dictionary& dict,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
static void StartLoadingHttp(
@ -85,11 +85,11 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
const network::ResourceRequest& original_request,
network::mojom::URLLoaderClientPtr client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
const mate::Dictionary& dict);
const gin_helper::Dictionary& dict);
static void StartLoadingStream(network::mojom::URLLoaderRequest loader,
network::mojom::URLLoaderClientPtr client,
network::ResourceResponseHead head,
const mate::Dictionary& dict);
const gin_helper::Dictionary& dict);
// Helper to send string as response.
static void SendContents(network::mojom::URLLoaderClientPtr client,