1 module awebview.wrapper.cpp.resourceinterceptor; 2 3 4 mixin template Awesomium() 5 { 6 interface ResourceInterceptor {} 7 interface ResourceRequest {} 8 interface ResourceResponse {} 9 interface UploadElement {} 10 } 11 12 13 mixin template Awesomium4D() 14 { 15 interface IResourceInterceptorD 16 { 17 Awesomium.ResourceResponse onRequest(Awesomium.ResourceRequest req); 18 bool onFilterNavigation(int opid, int orid, 19 const(Awesomium.WebString) method, 20 const(Awesomium.WebURL) url, 21 bool is_main_frame); 22 void onWillDownload(int opid, int orid, 23 const(Awesomium.WebURL) url); 24 } 25 26 27 interface ResourceInterceptorD2Cpp : Awesomium.ResourceInterceptor {} 28 extern(C++, ResourceInterceptorD2CppMember) 29 { 30 ResourceInterceptorD2Cpp newCtor(IResourceInterceptorD, ulong); 31 void deleteDtor(ResourceInterceptorD2Cpp); 32 } 33 34 extern(C++, ResourceInterceptorMember) 35 { 36 void ctor(ResourceInterceptor p); 37 ResourceInterceptor newCtor(); 38 void dtor(ResourceInterceptor p); 39 void deleteDtor(ResourceInterceptor p); 40 41 ResourceResponse OnRequest(ResourceInterceptor p, 42 ResourceRequest request); 43 44 bool OnFilterNavigation(ResourceInterceptor p, 45 int origin_process_id, 46 int origin_routing_id, 47 const WebString method, 48 const WebURL url, 49 bool is_main_frame); 50 51 void OnWillDownload(ResourceInterceptor p, 52 int origin_process_id, 53 int origin_routing_id, 54 const WebURL url); 55 } 56 57 58 interface IResourceRequestD 59 { 60 void cancel(); 61 int originProcessId() const; 62 int originRoutingId() const; 63 void getUrl(WebURL dst) const; 64 void getMethod(WebString dst) const; 65 void setMethod(const(WebString) m); 66 void getReferrer(WebString dst) const; 67 void setReferrer(const(WebString) r); 68 void getExtraHandlers(WebString dst) const; 69 void setExtraHeaders(const(WebString) eh); 70 void appendExtraHeader(const(WebString) name, const(WebString) value); 71 uint numUploadElements() const; 72 const(Awesomium.UploadElement) getUploadElement(uint idx) const; 73 void clearUploadElements(); 74 void appendUploadFilePath(const(WebString) path); 75 void appendUploadBytes(const(char)* bytes, uint num_bytes); 76 void ignoreDataSourceHandler(bool ignore) @property; 77 } 78 79 80 interface ResourceRequestD2Cpp : Awesomium.ResourceRequest {} 81 extern(C++, ResourceRequestD2CppMember) 82 { 83 ResourceRequestD2Cpp newCtor(IResourceRequestD p, ulong); 84 void deleteDtor(ResourceRequestD2Cpp p); 85 } 86 87 88 extern(C++, ResourceRequestMember) 89 { 90 void Cancel(Awesomium.ResourceRequest p); 91 int origin_process_id(const(Awesomium.ResourceRequest) p); 92 int origin_routing_id(const(Awesomium.ResourceRequest) p); 93 void url(const(Awesomium.ResourceRequest) p, Awesomium.WebURL dst); 94 void method(const(Awesomium.ResourceRequest) p, Awesomium.WebString dst); 95 void set_method(Awesomium.ResourceRequest p, const(Awesomium.WebString) method); 96 void referrer(const(Awesomium.ResourceRequest) p, Awesomium.WebString dst); 97 void set_referrer(Awesomium.ResourceRequest p, const(Awesomium.WebString) referrer); 98 void extra_headers(const(Awesomium.ResourceRequest) p, Awesomium.WebString dst); 99 void set_extra_headers(Awesomium.ResourceRequest p, const(Awesomium.WebString) headers); 100 void AppendExtraHeader(Awesomium.ResourceRequest p, const(Awesomium.WebString) name, const(Awesomium.WebString) value); 101 uint num_upload_elements(const(Awesomium.ResourceRequest) p); 102 const(void)* GetUploadElement(const(Awesomium.ResourceRequest) p, uint idx); 103 void ClearUploadElements(Awesomium.ResourceRequest p); 104 void AppendUploadFilePath(Awesomium.ResourceRequest p, const(Awesomium.WebString) path); 105 void AppendUploadBytes(Awesomium.ResourceRequest p, const(char)* bytes, uint num_bytes); 106 void set_ignore_data_source_handler(Awesomium.ResourceRequest p, bool ignore); 107 } 108 109 110 interface IResourceResponseD {} 111 interface ResourceResponseD2Cpp : Awesomium.ResourceResponse {} 112 extern(C++, ResourceResponseD2CppMember) {} 113 114 extern(C++, ResourceResponseMember) 115 { 116 ResourceResponse Create(uint num_bytes, const(ubyte)* buffer, const WebString mime_type); 117 ResourceResponse Create(const WebString file_path); 118 } 119 120 121 interface IUploadElementD 122 { 123 bool isFilePath() const; 124 bool isBytes() const; 125 uint numBytes() const; 126 const(ubyte)* bytes() const; 127 void getFilePath(Awesomium.WebString dst) const; 128 } 129 130 interface UploadElementD2Cpp : Awesomium.UploadElement {} 131 132 extern(C++, UploadElementD2CppMember) 133 { 134 UploadElementD2Cpp newCtor(IUploadElementD p, ulong); 135 void deleteDtor(UploadElementD2Cpp); 136 } 137 138 extern(C++, UploadElementMember) 139 { 140 bool IsFilePath(const UploadElement p); 141 bool IsBytes(const UploadElement p); 142 uint num_bytes(const UploadElement p); 143 const(ubyte)* bytes(const UploadElement p); 144 void file_path(const UploadElement p, WebString dst); 145 } 146 }