-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathCefResponse_N.cpp
185 lines (160 loc) · 6.49 KB
/
CefResponse_N.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "CefResponse_N.h"
#include "include/cef_response.h"
#include "jni_scoped_helpers.h"
#include "jni_util.h"
namespace {
const char kCefClassName[] = "CefResponse";
CefRefPtr<CefResponse> GetSelf(jlong self) {
return reinterpret_cast<CefResponse*>(self);
}
} // namespace
JNIEXPORT jobject JNICALL
Java_org_cef_network_CefResponse_1N_N_1Create(JNIEnv* env, jclass cls) {
CefRefPtr<CefResponse> response = CefResponse::Create();
ScopedJNIResponse jresponse(env, response);
return jresponse.Release();
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1Dispose(JNIEnv* env,
jobject obj,
jlong self) {
SetCefForJNIObject<CefResponse>(env, obj, nullptr, kCefClassName);
}
JNIEXPORT jboolean JNICALL
Java_org_cef_network_CefResponse_1N_N_1IsReadOnly(JNIEnv* env,
jobject obj,
jlong self) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return JNI_FALSE;
return response->IsReadOnly() ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jobject JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetError(JNIEnv* env,
jobject obj,
jlong self) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return nullptr;
return NewJNIErrorCode(env, response->GetError());
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetError(JNIEnv* env,
jobject obj,
jlong self,
jobject jerrorCode) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
if (!jerrorCode)
return;
response->SetError(GetJNIErrorCode(env, jerrorCode));
}
JNIEXPORT jint JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetStatus(JNIEnv* env,
jobject obj,
jlong self) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return 0;
return response->GetStatus();
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetStatus(JNIEnv* env,
jobject obj,
jlong self,
jint jstatus) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
return response->SetStatus(jstatus);
}
JNIEXPORT jstring JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetStatusText(JNIEnv* env,
jobject obj,
jlong self) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return nullptr;
return NewJNIString(env, response->GetStatusText());
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetStatusText(JNIEnv* env,
jobject obj,
jlong self,
jstring jstatus) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
response->SetStatusText(GetJNIString(env, jstatus));
}
JNIEXPORT jstring JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetMimeType(JNIEnv* env,
jobject obj,
jlong self) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return nullptr;
return NewJNIString(env, response->GetMimeType());
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetMimeType(JNIEnv* env,
jobject obj,
jlong self,
jstring jmimeType) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
response->SetMimeType(GetJNIString(env, jmimeType));
}
JNIEXPORT jstring JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetHeaderByName(JNIEnv* env,
jobject obj,
jlong self,
jstring jname) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return nullptr;
return NewJNIString(env, response->GetHeaderByName(GetJNIString(env, jname)));
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetHeaderByName(JNIEnv* env,
jobject obj,
jlong self,
jstring jname,
jstring jvalue,
jboolean joverride) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
return response->SetHeaderByName(GetJNIString(env, jname),
GetJNIString(env, jvalue),
joverride != JNI_FALSE);
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1GetHeaderMap(JNIEnv* env,
jobject obj,
jlong self,
jobject jheaderMap) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
CefResponse::HeaderMap headerMap;
response->GetHeaderMap(headerMap);
SetJNIStringMultiMap(env, jheaderMap, headerMap);
}
JNIEXPORT void JNICALL
Java_org_cef_network_CefResponse_1N_N_1SetHeaderMap(JNIEnv* env,
jobject obj,
jlong self,
jobject jheaderMap) {
CefRefPtr<CefResponse> response = GetSelf(self);
if (!response)
return;
CefResponse::HeaderMap headerMap;
GetJNIStringMultiMap(env, jheaderMap, headerMap);
response->SetHeaderMap(headerMap);
}