| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" | 13 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" |
| 14 #include "ppapi/shared_impl/ppb_url_request_info_shared.h" | |
| 15 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
| 16 #include "ppapi/shared_impl/tracked_callback.h" | 15 #include "ppapi/shared_impl/tracked_callback.h" |
| 16 #include "ppapi/shared_impl/url_request_info_data.h" |
| 17 #include "ppapi/thunk/ppb_url_loader_api.h" | 17 #include "ppapi/thunk/ppb_url_loader_api.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader
Client.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader
Client.h" |
| 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 20 | 20 |
| 21 namespace WebKit { | 21 namespace WebKit { |
| 22 class WebURL; | 22 class WebURL; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace webkit { | 25 namespace webkit { |
| 26 namespace ppapi { | 26 namespace ppapi { |
| 27 | 27 |
| 28 class PPB_URLResponseInfo_Impl; | 28 class PPB_URLResponseInfo_Impl; |
| 29 | 29 |
| 30 class PPB_URLLoader_Impl : public ::ppapi::Resource, | 30 class PPB_URLLoader_Impl : public ::ppapi::Resource, |
| 31 public ::ppapi::thunk::PPB_URLLoader_API, | 31 public ::ppapi::thunk::PPB_URLLoader_API, |
| 32 public WebKit::WebURLLoaderClient { | 32 public WebKit::WebURLLoaderClient { |
| 33 public: | 33 public: |
| 34 PPB_URLLoader_Impl(PP_Instance instance, bool main_document_loader); | 34 PPB_URLLoader_Impl(PP_Instance instance, bool main_document_loader); |
| 35 virtual ~PPB_URLLoader_Impl(); | 35 virtual ~PPB_URLLoader_Impl(); |
| 36 | 36 |
| 37 // Resource overrides. | 37 // Resource overrides. |
| 38 virtual ::ppapi::thunk::PPB_URLLoader_API* AsPPB_URLLoader_API() OVERRIDE; | 38 virtual ::ppapi::thunk::PPB_URLLoader_API* AsPPB_URLLoader_API() OVERRIDE; |
| 39 virtual void InstanceWasDeleted() OVERRIDE; | 39 virtual void InstanceWasDeleted() OVERRIDE; |
| 40 | 40 |
| 41 // PPB_URLLoader_API implementation. | 41 // PPB_URLLoader_API implementation. |
| 42 virtual int32_t Open( | 42 virtual int32_t Open( |
| 43 PP_Resource request_id, | 43 PP_Resource request_id, |
| 44 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 44 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 45 int32_t Open(const ::ppapi::URLRequestInfoData& data, |
| 46 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 45 virtual int32_t FollowRedirect( | 47 virtual int32_t FollowRedirect( |
| 46 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 48 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 47 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, | 49 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, |
| 48 int64_t* total_bytes_to_be_sent) OVERRIDE; | 50 int64_t* total_bytes_to_be_sent) OVERRIDE; |
| 49 virtual PP_Bool GetDownloadProgress( | 51 virtual PP_Bool GetDownloadProgress( |
| 50 int64_t* bytes_received, | 52 int64_t* bytes_received, |
| 51 int64_t* total_bytes_to_be_received) OVERRIDE; | 53 int64_t* total_bytes_to_be_received) OVERRIDE; |
| 52 virtual PP_Resource GetResponseInfo() OVERRIDE; | 54 virtual PP_Resource GetResponseInfo() OVERRIDE; |
| 53 virtual int32_t ReadResponseBody( | 55 virtual int32_t ReadResponseBody( |
| 54 void* buffer, | 56 void* buffer, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 126 |
| 125 void FinishLoading(int32_t done_status); | 127 void FinishLoading(int32_t done_status); |
| 126 | 128 |
| 127 // If true, then the plugin instance is a full-frame plugin and we're just | 129 // If true, then the plugin instance is a full-frame plugin and we're just |
| 128 // wrapping the main document's loader (i.e. loader_ is null). | 130 // wrapping the main document's loader (i.e. loader_ is null). |
| 129 bool main_document_loader_; | 131 bool main_document_loader_; |
| 130 | 132 |
| 131 // Keep a copy of the request data. We specifically do this instead of | 133 // Keep a copy of the request data. We specifically do this instead of |
| 132 // keeping a reference to the request resource, because the plugin might | 134 // keeping a reference to the request resource, because the plugin might |
| 133 // change the request info resource out from under us. | 135 // change the request info resource out from under us. |
| 134 ::ppapi::PPB_URLRequestInfo_Data request_data_; | 136 ::ppapi::URLRequestInfoData request_data_; |
| 135 | 137 |
| 136 // The loader associated with this request. MAY BE NULL. | 138 // The loader associated with this request. MAY BE NULL. |
| 137 // | 139 // |
| 138 // This will be NULL if the load hasn't been opened yet, or if this is a main | 140 // This will be NULL if the load hasn't been opened yet, or if this is a main |
| 139 // document loader (when registered as a mime type). Therefore, you should | 141 // document loader (when registered as a mime type). Therefore, you should |
| 140 // always NULL check this value before using it. In the case of a main | 142 // always NULL check this value before using it. In the case of a main |
| 141 // document load, you would call the functions on the document to cancel the | 143 // document load, you would call the functions on the document to cancel the |
| 142 // load, etc. since there is no loader. | 144 // load, etc. since there is no loader. |
| 143 scoped_ptr<WebKit::WebURLLoader> loader_; | 145 scoped_ptr<WebKit::WebURLLoader> loader_; |
| 144 | 146 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 159 | 161 |
| 160 PP_URLLoaderTrusted_StatusCallback status_callback_; | 162 PP_URLLoaderTrusted_StatusCallback status_callback_; |
| 161 | 163 |
| 162 DISALLOW_COPY_AND_ASSIGN(PPB_URLLoader_Impl); | 164 DISALLOW_COPY_AND_ASSIGN(PPB_URLLoader_Impl); |
| 163 }; | 165 }; |
| 164 | 166 |
| 165 } // namespace ppapi | 167 } // namespace ppapi |
| 166 } // namespace webkit | 168 } // namespace webkit |
| 167 | 169 |
| 168 #endif // WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ | 170 #endif // WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ |
| OLD | NEW |