| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void UpdateStatus(); | 110 void UpdateStatus(); |
| 111 | 111 |
| 112 // Returns true if the plugin has requested we record download or upload | 112 // Returns true if the plugin has requested we record download or upload |
| 113 // progress. When false, we don't need to update the counters. We go out of | 113 // progress. When false, we don't need to update the counters. We go out of |
| 114 // our way not to allow access to this information unless it's requested, | 114 // our way not to allow access to this information unless it's requested, |
| 115 // even when it would be easier just to return it and not check, so that | 115 // even when it would be easier just to return it and not check, so that |
| 116 // plugins don't depend on access without setting the flag. | 116 // plugins don't depend on access without setting the flag. |
| 117 bool RecordDownloadProgress() const; | 117 bool RecordDownloadProgress() const; |
| 118 bool RecordUploadProgress() const; | 118 bool RecordUploadProgress() const; |
| 119 | 119 |
| 120 // Calls SetDefersLoading on the current load. This encapsulates the logic |
| 121 // differences between document loads and regular ones. |
| 122 void SetDefersLoading(bool defers_loading); |
| 123 |
| 120 void FinishLoading(int32_t done_status); | 124 void FinishLoading(int32_t done_status); |
| 121 | 125 |
| 122 // If true, then the plugin instance is a full-frame plugin and we're just | 126 // If true, then the plugin instance is a full-frame plugin and we're just |
| 123 // wrapping the main document's loader (i.e. loader_ is null). | 127 // wrapping the main document's loader (i.e. loader_ is null). |
| 124 bool main_document_loader_; | 128 bool main_document_loader_; |
| 125 | 129 |
| 126 // Keep a copy of the request data. We specifically do this instead of | 130 // Keep a copy of the request data. We specifically do this instead of |
| 127 // keeping a reference to the request resource, because the plugin might | 131 // keeping a reference to the request resource, because the plugin might |
| 128 // change the request info resource out from under us. | 132 // change the request info resource out from under us. |
| 129 ::ppapi::PPB_URLRequestInfo_Data request_data_; | 133 ::ppapi::PPB_URLRequestInfo_Data request_data_; |
| 130 | 134 |
| 135 // The loader associated with this request. MAY BE NULL. |
| 136 // |
| 137 // This will be NULL if the load hasn't been opened yet, or if this is a main |
| 138 // document loader (when registered as a mime type). Therefore, you should |
| 139 // always NULL check this value before using it. In the case of a main |
| 140 // document load, you would call the functions on the document to cancel the |
| 141 // load, etc. since there is no loader. |
| 131 scoped_ptr<WebKit::WebURLLoader> loader_; | 142 scoped_ptr<WebKit::WebURLLoader> loader_; |
| 143 |
| 132 scoped_refptr<PPB_URLResponseInfo_Impl> response_info_; | 144 scoped_refptr<PPB_URLResponseInfo_Impl> response_info_; |
| 133 scoped_refptr<TrackedCompletionCallback> pending_callback_; | 145 scoped_refptr<TrackedCompletionCallback> pending_callback_; |
| 134 std::deque<char> buffer_; | 146 std::deque<char> buffer_; |
| 135 int64_t bytes_sent_; | 147 int64_t bytes_sent_; |
| 136 int64_t total_bytes_to_be_sent_; | 148 int64_t total_bytes_to_be_sent_; |
| 137 int64_t bytes_received_; | 149 int64_t bytes_received_; |
| 138 int64_t total_bytes_to_be_received_; | 150 int64_t total_bytes_to_be_received_; |
| 139 char* user_buffer_; | 151 char* user_buffer_; |
| 140 size_t user_buffer_size_; | 152 size_t user_buffer_size_; |
| 141 int32_t done_status_; | 153 int32_t done_status_; |
| 142 bool is_streaming_to_file_; | 154 bool is_streaming_to_file_; |
| 143 bool is_asynchronous_load_suspended_; | 155 bool is_asynchronous_load_suspended_; |
| 144 | 156 |
| 145 bool has_universal_access_; | 157 bool has_universal_access_; |
| 146 | 158 |
| 147 PP_URLLoaderTrusted_StatusCallback status_callback_; | 159 PP_URLLoaderTrusted_StatusCallback status_callback_; |
| 148 | 160 |
| 149 DISALLOW_COPY_AND_ASSIGN(PPB_URLLoader_Impl); | 161 DISALLOW_COPY_AND_ASSIGN(PPB_URLLoader_Impl); |
| 150 }; | 162 }; |
| 151 | 163 |
| 152 } // namespace ppapi | 164 } // namespace ppapi |
| 153 } // namespace webkit | 165 } // namespace webkit |
| 154 | 166 |
| 155 #endif // WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ | 167 #endif // WEBKIT_PLUGINS_PPAPI_PPB_URL_LOADER_IMPL_H_ |
| OLD | NEW |