net_converter.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_
  5. #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_
  6. #include "base/memory/ref_counted.h"
  7. #include "native_mate/converter.h"
  8. namespace base {
  9. class DictionaryValue;
  10. class ListValue;
  11. } // namespace base
  12. namespace net {
  13. class AuthChallengeInfo;
  14. class URLRequest;
  15. class X509Certificate;
  16. class HttpResponseHeaders;
  17. struct CertPrincipal;
  18. } // namespace net
  19. namespace mate {
  20. template <>
  21. struct Converter<const net::AuthChallengeInfo*> {
  22. static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
  23. const net::AuthChallengeInfo* val);
  24. };
  25. template <>
  26. struct Converter<scoped_refptr<net::X509Certificate>> {
  27. static v8::Local<v8::Value> ToV8(
  28. v8::Isolate* isolate,
  29. const scoped_refptr<net::X509Certificate>& val);
  30. static bool FromV8(v8::Isolate* isolate,
  31. v8::Local<v8::Value> val,
  32. scoped_refptr<net::X509Certificate>* out);
  33. };
  34. template <>
  35. struct Converter<net::CertPrincipal> {
  36. static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
  37. const net::CertPrincipal& val);
  38. };
  39. template <>
  40. struct Converter<net::HttpResponseHeaders*> {
  41. static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
  42. net::HttpResponseHeaders* headers);
  43. static bool FromV8(v8::Isolate* isolate,
  44. v8::Local<v8::Value> val,
  45. net::HttpResponseHeaders* out);
  46. };
  47. } // namespace mate
  48. namespace atom {
  49. void FillRequestDetails(base::DictionaryValue* details,
  50. const net::URLRequest* request);
  51. void GetUploadData(base::ListValue* upload_data_list,
  52. const net::URLRequest* request);
  53. } // namespace atom
  54. #endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_NET_CONVERTER_H_