summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/pepper_url_request_info.cc
diff options
context:
space:
mode:
authordmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-05 14:45:44 +0000
committerdmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-05 14:45:44 +0000
commit6f2e3919c4709404d8d7b6742f9cd9989b799c98 (patch)
tree55a933f7e2988625f0f3ded5a562203c7e3921c9 /webkit/glue/plugins/pepper_url_request_info.cc
parent79ba2d8a26fe6c9b343c57fef57896a90baa3878 (diff)
downloadchromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.zip
chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.gz
chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.bz2
Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on Windows). This includes changing bool to PP_Bool and adding a PP_INLINE macro.
TEST=tests/test_c_includes.c BUG=59791,53451 The first patch set is a straight copy of http://codereview.chromium.org/4019010/show which got LGTMed when PPAPI was in its own repo, but had to be rolled back in order to include chrome changes. IMPORTANT: This change will break plugin implementations that use the C interface, and might break others as well. Review URL: http://codereview.chromium.org/4310002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/pepper_url_request_info.cc')
-rw-r--r--webkit/glue/plugins/pepper_url_request_info.cc56
1 files changed, 32 insertions, 24 deletions
diff --git a/webkit/glue/plugins/pepper_url_request_info.cc b/webkit/glue/plugins/pepper_url_request_info.cc
index 723b327..a7a6589 100644
--- a/webkit/glue/plugins/pepper_url_request_info.cc
+++ b/webkit/glue/plugins/pepper_url_request_info.cc
@@ -15,6 +15,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
+#include "webkit/glue/plugins/pepper_common.h"
#include "webkit/glue/plugins/pepper_file_ref.h"
#include "webkit/glue/plugins/pepper_plugin_module.h"
#include "webkit/glue/plugins/pepper_string.h"
@@ -38,12 +39,12 @@ const char* const kIgnoredRequestHeaders[] = {
"content-length"
};
-bool IsIgnoredRequestHeader(const std::string& name) {
+PP_Bool IsIgnoredRequestHeader(const std::string& name) {
for (size_t i = 0; i < arraysize(kIgnoredRequestHeaders); ++i) {
if (LowerCaseEqualsASCII(name, kIgnoredRequestHeaders[i]))
- return true;
+ return PP_TRUE;
}
- return false;
+ return PP_FALSE;
}
PP_Resource Create(PP_Module module_id) {
@@ -56,40 +57,47 @@ PP_Resource Create(PP_Module module_id) {
return request->GetReference();
}
-bool IsURLRequestInfo(PP_Resource resource) {
- return !!Resource::GetAs<URLRequestInfo>(resource);
+PP_Bool IsURLRequestInfo(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<URLRequestInfo>(resource));
}
-bool SetProperty(PP_Resource request_id,
- PP_URLRequestProperty_Dev property,
- PP_Var var) {
+PP_Bool SetProperty(PP_Resource request_id,
+ PP_URLRequestProperty_Dev property,
+ PP_Var var) {
scoped_refptr<URLRequestInfo> request(
Resource::GetAs<URLRequestInfo>(request_id));
if (!request)
- return false;
+ return PP_FALSE;
- if (var.type == PP_VARTYPE_BOOL)
- return request->SetBooleanProperty(property, var.value.as_bool);
+ if (var.type == PP_VARTYPE_BOOL) {
+ return BoolToPPBool(
+ request->SetBooleanProperty(property,
+ PPBoolToBool(var.value.as_bool)));
+ }
if (var.type == PP_VARTYPE_STRING) {
scoped_refptr<StringVar> string(StringVar::FromPPVar(var));
- if (string)
- return request->SetStringProperty(property, string->value());
+ if (string) {
+ return BoolToPPBool(request->SetStringProperty(property,
+ string->value()));
+ }
}
- return false;
+ return PP_FALSE;
}
-bool AppendDataToBody(PP_Resource request_id, const char* data, uint32_t len) {
+PP_Bool AppendDataToBody(PP_Resource request_id,
+ const char* data,
+ uint32_t len) {
scoped_refptr<URLRequestInfo> request(
Resource::GetAs<URLRequestInfo>(request_id));
if (!request)
- return false;
+ return PP_FALSE;
- return request->AppendDataToBody(std::string(data, len));
+ return BoolToPPBool(request->AppendDataToBody(std::string(data, len)));
}
-bool AppendFileToBody(PP_Resource request_id,
+PP_Bool AppendFileToBody(PP_Resource request_id,
PP_Resource file_ref_id,
int64_t start_offset,
int64_t number_of_bytes,
@@ -97,16 +105,16 @@ bool AppendFileToBody(PP_Resource request_id,
scoped_refptr<URLRequestInfo> request(
Resource::GetAs<URLRequestInfo>(request_id));
if (!request)
- return false;
+ return PP_FALSE;
scoped_refptr<FileRef> file_ref(Resource::GetAs<FileRef>(file_ref_id));
if (!file_ref)
- return false;
+ return PP_FALSE;
- return request->AppendFileToBody(file_ref,
- start_offset,
- number_of_bytes,
- expected_last_modified_time);
+ return BoolToPPBool(request->AppendFileToBody(file_ref,
+ start_offset,
+ number_of_bytes,
+ expected_last_modified_time));
}
const PPB_URLRequestInfo_Dev ppb_urlrequestinfo = {