// Copyright (c) 2015 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #ifndef SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_ #define SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_ #include "native_mate/arguments.h" #include "native_mate/handle.h" #include "shell/browser/api/trackable_object.h" #include "shell/browser/net/atom_network_delegate.h" namespace electron { class AtomBrowserContext; namespace api { class WebRequest : public mate::TrackableObject { public: static mate::Handle Create(v8::Isolate* isolate, AtomBrowserContext* browser_context); static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); protected: WebRequest(v8::Isolate* isolate, AtomBrowserContext* browser_context); ~WebRequest() override; // C++ can not distinguish overloaded member function. template void SetSimpleListener(mate::Arguments* args); template void SetResponseListener(mate::Arguments* args); template void SetListener(Method method, Event type, mate::Arguments* args); private: scoped_refptr browser_context_; DISALLOW_COPY_AND_ASSIGN(WebRequest); }; } // namespace api } // namespace electron #endif // SHELL_BROWSER_API_ATOM_API_WEB_REQUEST_H_