diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 21:43:01 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 21:43:01 +0000 |
commit | 5a3f62856d89817d4117de189e855a6dad16c2ee (patch) | |
tree | a7df5acea5b54ea8ca795b0ba5a1dc90316d450e /ppapi/cpp | |
parent | 7631cf8806adf505db4fed53210e27d2d1dd2cd0 (diff) | |
download | chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.zip chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.tar.gz chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.tar.bz2 |
Move URLLoader, URLRequestInfo, and URLResponseInfo out of the dev directory
and rename accordingly.
Rename URLResponseInfo.GetBody to GetBodyAsFileRef.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/4747001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/dev/url_response_info_dev.cc | 54 | ||||
-rw-r--r-- | ppapi/cpp/instance.cc | 4 | ||||
-rw-r--r-- | ppapi/cpp/instance.h | 6 | ||||
-rw-r--r-- | ppapi/cpp/module.cc | 4 | ||||
-rw-r--r-- | ppapi/cpp/url_loader.cc (renamed from ppapi/cpp/dev/url_loader_dev.cc) | 57 | ||||
-rw-r--r-- | ppapi/cpp/url_loader.h (renamed from ppapi/cpp/dev/url_loader_dev.h) | 27 | ||||
-rw-r--r-- | ppapi/cpp/url_request_info.cc (renamed from ppapi/cpp/dev/url_request_info_dev.cc) | 34 | ||||
-rw-r--r-- | ppapi/cpp/url_request_info.h (renamed from ppapi/cpp/dev/url_request_info_dev.h) | 21 | ||||
-rw-r--r-- | ppapi/cpp/url_response_info.cc | 42 | ||||
-rw-r--r-- | ppapi/cpp/url_response_info.h (renamed from ppapi/cpp/dev/url_response_info_dev.h) | 23 |
10 files changed, 112 insertions, 160 deletions
diff --git a/ppapi/cpp/dev/url_response_info_dev.cc b/ppapi/cpp/dev/url_response_info_dev.cc deleted file mode 100644 index abeca7f..0000000 --- a/ppapi/cpp/dev/url_response_info_dev.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2010 The Chromium 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 "ppapi/cpp/dev/url_response_info_dev.h" - -#include "ppapi/cpp/dev/file_ref_dev.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" - -namespace { - -DeviceFuncs<PPB_URLResponseInfo_Dev> url_response_info_f( - PPB_URLRESPONSEINFO_DEV_INTERFACE); - -} // namespace - -namespace pp { - -URLResponseInfo_Dev::URLResponseInfo_Dev(const URLResponseInfo_Dev& other) - : Resource(other) { -} - -URLResponseInfo_Dev::URLResponseInfo_Dev(PassRef, PP_Resource resource) { - PassRefFromConstructor(resource); -} - -URLResponseInfo_Dev& URLResponseInfo_Dev::operator=( - const URLResponseInfo_Dev& other) { - URLResponseInfo_Dev copy(other); - swap(copy); - return *this; -} - -void URLResponseInfo_Dev::swap(URLResponseInfo_Dev& other) { - Resource::swap(other); -} - -Var URLResponseInfo_Dev::GetProperty( - PP_URLResponseProperty_Dev property) const { - if (!url_response_info_f) - return Var(); - return Var(Var::PassRef(), - url_response_info_f->GetProperty(pp_resource(), property)); -} - -FileRef_Dev URLResponseInfo_Dev::GetBody() const { - if (!url_response_info_f) - return FileRef_Dev(); - return FileRef_Dev(FileRef_Dev::PassRef(), - url_response_info_f->GetBody(pp_resource())); -} - -} // namespace pp diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc index 86996d6..394be04 100644 --- a/ppapi/cpp/instance.cc +++ b/ppapi/cpp/instance.cc @@ -8,8 +8,6 @@ #include "ppapi/c/ppb_instance.h" #include "ppapi/cpp/common.h" #include "ppapi/cpp/dev/graphics_3d_dev.h" -#include "ppapi/cpp/dev/scrollbar_dev.h" -#include "ppapi/cpp/dev/widget_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/logging.h" @@ -53,7 +51,7 @@ void Instance::DidChangeFocus(bool /*has_focus*/) { } -bool Instance::HandleDocumentLoad(const URLLoader_Dev& /*url_loader*/) { +bool Instance::HandleDocumentLoad(const URLLoader& /*url_loader*/) { return false; } diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h index e0a5889..d74995e 100644 --- a/ppapi/cpp/instance.h +++ b/ppapi/cpp/instance.h @@ -16,7 +16,6 @@ #include <map> #include <string> -#include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" @@ -33,8 +32,7 @@ class Point; class Rect; class Rect; class Resource; -class Scrollbar_Dev; -class URLLoader_Dev; +class URLLoader; class Var; class Widget_Dev; @@ -69,7 +67,7 @@ class Instance { virtual bool HandleInputEvent(const PP_InputEvent& event); /** See PPP_Instance.HandleDocumentLoad. */ - virtual bool HandleDocumentLoad(const URLLoader_Dev& url_loader); + virtual bool HandleDocumentLoad(const URLLoader& url_loader); /** See PPP_Instance.GetInstanceObject. */ virtual Var GetInstanceObject(); diff --git a/ppapi/cpp/module.cc b/ppapi/cpp/module.cc index 1aa5ea8..d6adddc 100644 --- a/ppapi/cpp/module.cc +++ b/ppapi/cpp/module.cc @@ -29,7 +29,7 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/cpp/common.h" -#include "ppapi/cpp/dev/url_loader_dev.h" +#include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/resource.h" @@ -111,7 +111,7 @@ PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, if (!instance) return PP_FALSE; return BoolToPPBool( - instance->HandleDocumentLoad(URLLoader_Dev(pp_url_loader))); + instance->HandleDocumentLoad(URLLoader(pp_url_loader))); } PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) { diff --git a/ppapi/cpp/dev/url_loader_dev.cc b/ppapi/cpp/url_loader.cc index b7fdc03..2a56a83 100644 --- a/ppapi/cpp/dev/url_loader_dev.cc +++ b/ppapi/cpp/url_loader.cc @@ -2,67 +2,56 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/cpp/dev/url_loader_dev.h" +#include "ppapi/cpp/url_loader.h" -#include "ppapi/c/dev/ppb_url_loader_dev.h" +#include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/pp_errors.h" #include "ppapi/cpp/common.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/dev/file_ref_dev.h" -#include "ppapi/cpp/dev/url_request_info_dev.h" -#include "ppapi/cpp/dev/url_response_info_dev.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/url_request_info.h" +#include "ppapi/cpp/url_response_info.h" namespace { -DeviceFuncs<PPB_URLLoader_Dev> url_loader_f(PPB_URLLOADER_DEV_INTERFACE); +DeviceFuncs<PPB_URLLoader> url_loader_f(PPB_URLLOADER_INTERFACE); } // namespace namespace pp { -URLLoader_Dev::URLLoader_Dev(PP_Resource resource) : Resource(resource) { +URLLoader::URLLoader(PP_Resource resource) : Resource(resource) { } -URLLoader_Dev::URLLoader_Dev(const Instance& instance) { +URLLoader::URLLoader(const Instance& instance) { if (!url_loader_f) return; PassRefFromConstructor(url_loader_f->Create(instance.pp_instance())); } -URLLoader_Dev::URLLoader_Dev(const URLLoader_Dev& other) - : Resource(other) { +URLLoader::URLLoader(const URLLoader& other) : Resource(other) { } -URLLoader_Dev& URLLoader_Dev::operator=(const URLLoader_Dev& other) { - URLLoader_Dev copy(other); - swap(copy); - return *this; -} - -void URLLoader_Dev::swap(URLLoader_Dev& other) { - Resource::swap(other); -} - -int32_t URLLoader_Dev::Open(const URLRequestInfo_Dev& request_info, - const CompletionCallback& cc) { +int32_t URLLoader::Open(const URLRequestInfo& request_info, + const CompletionCallback& cc) { if (!url_loader_f) return PP_ERROR_NOINTERFACE; return url_loader_f->Open(pp_resource(), request_info.pp_resource(), cc.pp_completion_callback()); } -int32_t URLLoader_Dev::FollowRedirect(const CompletionCallback& cc) { +int32_t URLLoader::FollowRedirect(const CompletionCallback& cc) { if (!url_loader_f) return PP_ERROR_NOINTERFACE; return url_loader_f->FollowRedirect(pp_resource(), cc.pp_completion_callback()); } -bool URLLoader_Dev::GetUploadProgress(int64_t* bytes_sent, - int64_t* total_bytes_to_be_sent) const { +bool URLLoader::GetUploadProgress(int64_t* bytes_sent, + int64_t* total_bytes_to_be_sent) const { if (!url_loader_f) return false; return PPBoolToBool(url_loader_f->GetUploadProgress(pp_resource(), @@ -70,7 +59,7 @@ bool URLLoader_Dev::GetUploadProgress(int64_t* bytes_sent, total_bytes_to_be_sent)); } -bool URLLoader_Dev::GetDownloadProgress( +bool URLLoader::GetDownloadProgress( int64_t* bytes_received, int64_t* total_bytes_to_be_received) const { if (!url_loader_f) @@ -81,16 +70,16 @@ bool URLLoader_Dev::GetDownloadProgress( total_bytes_to_be_received)); } -URLResponseInfo_Dev URLLoader_Dev::GetResponseInfo() const { +URLResponseInfo URLLoader::GetResponseInfo() const { if (!url_loader_f) - return URLResponseInfo_Dev(); - return URLResponseInfo_Dev(URLResponseInfo_Dev::PassRef(), - url_loader_f->GetResponseInfo(pp_resource())); + return URLResponseInfo(); + return URLResponseInfo(URLResponseInfo::PassRef(), + url_loader_f->GetResponseInfo(pp_resource())); } -int32_t URLLoader_Dev::ReadResponseBody(char* buffer, - int32_t bytes_to_read, - const CompletionCallback& cc) { +int32_t URLLoader::ReadResponseBody(char* buffer, + int32_t bytes_to_read, + const CompletionCallback& cc) { if (!url_loader_f) return PP_ERROR_NOINTERFACE; return url_loader_f->ReadResponseBody(pp_resource(), @@ -99,14 +88,14 @@ int32_t URLLoader_Dev::ReadResponseBody(char* buffer, cc.pp_completion_callback()); } -int32_t URLLoader_Dev::FinishStreamingToFile(const CompletionCallback& cc) { +int32_t URLLoader::FinishStreamingToFile(const CompletionCallback& cc) { if (!url_loader_f) return PP_ERROR_NOINTERFACE; return url_loader_f->FinishStreamingToFile(pp_resource(), cc.pp_completion_callback()); } -void URLLoader_Dev::Close() { +void URLLoader::Close() { if (!url_loader_f) return; url_loader_f->Close(pp_resource()); diff --git a/ppapi/cpp/dev/url_loader_dev.h b/ppapi/cpp/url_loader.h index 4256c32..15f81fa 100644 --- a/ppapi/cpp/dev/url_loader_dev.h +++ b/ppapi/cpp/url_loader.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_URL_LOADER_DEV_H_ -#define PPAPI_CPP_DEV_URL_LOADER_DEV_H_ +#ifndef PPAPI_CPP_URL_LOADER_H_ +#define PPAPI_CPP_URL_LOADER_H_ #include "ppapi/c/pp_stdint.h" #include "ppapi/cpp/resource.h" @@ -12,8 +12,8 @@ namespace pp { class CompletionCallback; class Instance; -class URLRequestInfo_Dev; -class URLResponseInfo_Dev; +class URLRequestInfo; +class URLResponseInfo; // URLLoader provides an API to download URLs. // @@ -75,27 +75,24 @@ class URLResponseInfo_Dev; // bool did_open_; // }; // -class URLLoader_Dev : public Resource { +class URLLoader : public Resource { public: // Creates an is_null() URLLoader object. - URLLoader_Dev() {} + URLLoader() {} - explicit URLLoader_Dev(PP_Resource resource); - explicit URLLoader_Dev(const Instance& instance); - URLLoader_Dev(const URLLoader_Dev& other); - - URLLoader_Dev& operator=(const URLLoader_Dev& other); - void swap(URLLoader_Dev& other); + explicit URLLoader(PP_Resource resource); + explicit URLLoader(const Instance& instance); + URLLoader(const URLLoader& other); // PPB_URLLoader methods: - int32_t Open(const URLRequestInfo_Dev& request_info, + int32_t Open(const URLRequestInfo& request_info, const CompletionCallback& cc); int32_t FollowRedirect(const CompletionCallback& cc); bool GetUploadProgress(int64_t* bytes_sent, int64_t* total_bytes_to_be_sent) const; bool GetDownloadProgress(int64_t* bytes_received, int64_t* total_bytes_to_be_received) const; - URLResponseInfo_Dev GetResponseInfo() const; + URLResponseInfo GetResponseInfo() const; int32_t ReadResponseBody(char* buffer, int32_t bytes_to_read, const CompletionCallback& cc); @@ -105,4 +102,4 @@ class URLLoader_Dev : public Resource { } // namespace pp -#endif // PPAPI_CPP_DEV_URL_LOADER_DEV_H_ +#endif // PPAPI_CPP_URL_LOADER_H_ diff --git a/ppapi/cpp/dev/url_request_info_dev.cc b/ppapi/cpp/url_request_info.cc index 5b4a135..69a86cb 100644 --- a/ppapi/cpp/dev/url_request_info_dev.cc +++ b/ppapi/cpp/url_request_info.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/cpp/dev/url_request_info_dev.h" +#include "ppapi/cpp/url_request_info.h" #include "ppapi/cpp/common.h" #include "ppapi/cpp/dev/file_ref_dev.h" @@ -11,37 +11,26 @@ namespace { -DeviceFuncs<PPB_URLRequestInfo_Dev> url_request_info_f( - PPB_URLREQUESTINFO_DEV_INTERFACE); +DeviceFuncs<PPB_URLRequestInfo> url_request_info_f( + PPB_URLREQUESTINFO_INTERFACE); } // namespace namespace pp { -URLRequestInfo_Dev::URLRequestInfo_Dev() { +URLRequestInfo::URLRequestInfo() { if (!url_request_info_f) return; PassRefFromConstructor( url_request_info_f->Create(Module::Get()->pp_module())); } -URLRequestInfo_Dev::URLRequestInfo_Dev(const URLRequestInfo_Dev& other) +URLRequestInfo::URLRequestInfo(const URLRequestInfo& other) : Resource(other) { } -URLRequestInfo_Dev& URLRequestInfo_Dev::operator=( - const URLRequestInfo_Dev& other) { - URLRequestInfo_Dev copy(other); - swap(copy); - return *this; -} - -void URLRequestInfo_Dev::swap(URLRequestInfo_Dev& other) { - Resource::swap(other); -} - -bool URLRequestInfo_Dev::SetProperty(PP_URLRequestProperty_Dev property, - const Var& value) { +bool URLRequestInfo::SetProperty(PP_URLRequestProperty property, + const Var& value) { if (!url_request_info_f) return false; return PPBoolToBool(url_request_info_f->SetProperty(pp_resource(), @@ -49,7 +38,7 @@ bool URLRequestInfo_Dev::SetProperty(PP_URLRequestProperty_Dev property, value.pp_var())); } -bool URLRequestInfo_Dev::AppendDataToBody(const char* data, uint32_t len) { +bool URLRequestInfo::AppendDataToBody(const char* data, uint32_t len) { if (!url_request_info_f) return false; return PPBoolToBool(url_request_info_f->AppendDataToBody(pp_resource(), @@ -57,9 +46,8 @@ bool URLRequestInfo_Dev::AppendDataToBody(const char* data, uint32_t len) { len)); } -bool URLRequestInfo_Dev::AppendFileToBody( - const FileRef_Dev& file_ref, - PP_Time expected_last_modified_time) { +bool URLRequestInfo::AppendFileToBody(const FileRef_Dev& file_ref, + PP_Time expected_last_modified_time) { if (!url_request_info_f) return false; return PPBoolToBool( @@ -70,7 +58,7 @@ bool URLRequestInfo_Dev::AppendFileToBody( expected_last_modified_time)); } -bool URLRequestInfo_Dev::AppendFileRangeToBody( +bool URLRequestInfo::AppendFileRangeToBody( const FileRef_Dev& file_ref, int64_t start_offset, int64_t length, diff --git a/ppapi/cpp/dev/url_request_info_dev.h b/ppapi/cpp/url_request_info.h index 1d56543..10defc1 100644 --- a/ppapi/cpp/dev/url_request_info_dev.h +++ b/ppapi/cpp/url_request_info.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ -#define PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ +#ifndef PPAPI_CPP_URL_REQUEST_INFO_H_ +#define PPAPI_CPP_URL_REQUEST_INFO_H_ -#include "ppapi/c/dev/ppb_url_request_info_dev.h" +#include "ppapi/c/ppb_url_request_info.h" #include "ppapi/cpp/resource.h" #include "ppapi/cpp/var.h" @@ -13,16 +13,13 @@ namespace pp { class FileRef_Dev; -class URLRequestInfo_Dev : public Resource { +class URLRequestInfo : public Resource { public: - URLRequestInfo_Dev(); - URLRequestInfo_Dev(const URLRequestInfo_Dev& other); + URLRequestInfo(); + URLRequestInfo(const URLRequestInfo& other); - URLRequestInfo_Dev& operator=(const URLRequestInfo_Dev& other); - void swap(URLRequestInfo_Dev& other); - - // PPB_URLRequestInfo_Dev methods: - bool SetProperty(PP_URLRequestProperty_Dev property, const Var& value); + // PPB_URLRequestInfo methods: + bool SetProperty(PP_URLRequestProperty property, const Var& value); bool AppendDataToBody(const char* data, uint32_t len); bool AppendFileToBody(const FileRef_Dev& file_ref, PP_Time expected_last_modified_time = 0); @@ -54,4 +51,4 @@ class URLRequestInfo_Dev : public Resource { } // namespace pp -#endif // PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ +#endif // PPAPI_CPP_URL_REQUEST_INFO_H_ diff --git a/ppapi/cpp/url_response_info.cc b/ppapi/cpp/url_response_info.cc new file mode 100644 index 0000000..4a023aa --- /dev/null +++ b/ppapi/cpp/url_response_info.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2010 The Chromium 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 "ppapi/cpp/url_response_info.h" + +#include "ppapi/cpp/dev/file_ref_dev.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" + +namespace { + +DeviceFuncs<PPB_URLResponseInfo> url_response_info_f( + PPB_URLRESPONSEINFO_INTERFACE); + +} // namespace + +namespace pp { + +URLResponseInfo::URLResponseInfo(const URLResponseInfo& other) + : Resource(other) { +} + +URLResponseInfo::URLResponseInfo(PassRef, PP_Resource resource) { + PassRefFromConstructor(resource); +} + +Var URLResponseInfo::GetProperty(PP_URLResponseProperty property) const { + if (!url_response_info_f) + return Var(); + return Var(Var::PassRef(), + url_response_info_f->GetProperty(pp_resource(), property)); +} + +FileRef_Dev URLResponseInfo::GetBodyAsFileRef() const { + if (!url_response_info_f) + return FileRef_Dev(); + return FileRef_Dev(FileRef_Dev::PassRef(), + url_response_info_f->GetBodyAsFileRef(pp_resource())); +} + +} // namespace pp diff --git a/ppapi/cpp/dev/url_response_info_dev.h b/ppapi/cpp/url_response_info.h index 6596c8b..ac13b27 100644 --- a/ppapi/cpp/dev/url_response_info_dev.h +++ b/ppapi/cpp/url_response_info.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ -#define PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ +#ifndef PPAPI_CPP_URL_RESPONSE_INFO_H_ +#define PPAPI_CPP_URL_RESPONSE_INFO_H_ -#include "ppapi/c/dev/ppb_url_response_info_dev.h" +#include "ppapi/c/ppb_url_response_info.h" #include "ppapi/cpp/resource.h" #include "ppapi/cpp/var.h" @@ -13,24 +13,21 @@ namespace pp { class FileRef_Dev; -class URLResponseInfo_Dev : public Resource { +class URLResponseInfo : public Resource { public: // Creates an is_null() URLResponseInfo object. - URLResponseInfo_Dev() {} + URLResponseInfo() {} // This constructor is used when we've gotten a PP_Resource as a return value // that has already been addref'ed for us. struct PassRef {}; - URLResponseInfo_Dev(PassRef, PP_Resource resource); + URLResponseInfo(PassRef, PP_Resource resource); - URLResponseInfo_Dev(const URLResponseInfo_Dev& other); - - URLResponseInfo_Dev& operator=(const URLResponseInfo_Dev& other); - void swap(URLResponseInfo_Dev& other); + URLResponseInfo(const URLResponseInfo& other); // PPB_URLResponseInfo methods: - Var GetProperty(PP_URLResponseProperty_Dev property) const; - FileRef_Dev GetBody() const; + Var GetProperty(PP_URLResponseProperty property) const; + FileRef_Dev GetBodyAsFileRef() const; // Convenient helpers for getting properties: Var GetURL() const { @@ -55,4 +52,4 @@ class URLResponseInfo_Dev : public Resource { } // namespace pp -#endif // PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ +#endif // PPAPI_CPP_URL_RESPONSE_INFO_H_ |