| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 MSVC_PUSH_WARNING_LEVEL(0); | 10 MSVC_PUSH_WARNING_LEVEL(0); |
| 11 #include "Cursor.h" | 11 #include "Cursor.h" |
| 12 #include "Document.h" | 12 #include "Document.h" |
| 13 #include "DocumentLoader.h" |
| 13 #include "Element.h" | 14 #include "Element.h" |
| 14 #include "Event.h" | 15 #include "Event.h" |
| 15 #include "EventNames.h" | 16 #include "EventNames.h" |
| 16 #include "FloatPoint.h" | 17 #include "FloatPoint.h" |
| 17 #include "FormData.h" | 18 #include "FormData.h" |
| 18 #include "FocusController.h" | 19 #include "FocusController.h" |
| 19 #include "Frame.h" | 20 #include "Frame.h" |
| 20 #include "FrameLoader.h" | 21 #include "FrameLoader.h" |
| 21 #include "FrameLoadRequest.h" | 22 #include "FrameLoadRequest.h" |
| 22 #include "FrameTree.h" | 23 #include "FrameTree.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 private: | 105 private: |
| 105 WebCore::ResourceResponse resource_response_; | 106 WebCore::ResourceResponse resource_response_; |
| 106 // The lower bound of the byte range. | 107 // The lower bound of the byte range. |
| 107 int byte_range_lower_bound_; | 108 int byte_range_lower_bound_; |
| 108 // The upper bound of the byte range. | 109 // The upper bound of the byte range. |
| 109 int byte_range_upper_bound_; | 110 int byte_range_upper_bound_; |
| 110 // The handler for the data. | 111 // The handler for the data. |
| 111 WebPluginResourceClient* resource_client_; | 112 WebPluginResourceClient* resource_client_; |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 WebPluginContainer::WebPluginContainer(WebPluginImpl* impl) : impl_(impl) { } | 115 WebPluginContainer::WebPluginContainer(WebPluginImpl* impl) |
| 116 : impl_(impl), |
| 117 ignore_response_error_(false) { |
| 118 } |
| 115 | 119 |
| 116 WebPluginContainer::~WebPluginContainer() { | 120 WebPluginContainer::~WebPluginContainer() { |
| 117 impl_->SetContainer(NULL); | 121 impl_->SetContainer(NULL); |
| 118 MessageLoop::current()->DeleteSoon(FROM_HERE, impl_); | 122 MessageLoop::current()->DeleteSoon(FROM_HERE, impl_); |
| 119 } | 123 } |
| 120 | 124 |
| 121 NPObject* WebPluginContainer::GetPluginScriptableObject() { | 125 NPObject* WebPluginContainer::GetPluginScriptableObject() { |
| 122 return impl_->GetPluginScriptableObject(); | 126 return impl_->GetPluginScriptableObject(); |
| 123 } | 127 } |
| 124 | 128 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 218 |
| 215 void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds, | 219 void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds, |
| 216 WTF::Vector<WebCore::IntRect>* | 220 WTF::Vector<WebCore::IntRect>* |
| 217 cutouts) const { | 221 cutouts) const { |
| 218 impl_->windowCutoutRects(bounds, cutouts); | 222 impl_->windowCutoutRects(bounds, cutouts); |
| 219 } | 223 } |
| 220 | 224 |
| 221 void WebPluginContainer::didReceiveResponse( | 225 void WebPluginContainer::didReceiveResponse( |
| 222 const WebCore::ResourceResponse& response) { | 226 const WebCore::ResourceResponse& response) { |
| 223 | 227 |
| 228 set_ignore_response_error(false); |
| 229 |
| 224 HttpResponseInfo http_response_info; | 230 HttpResponseInfo http_response_info; |
| 225 ReadHttpResponseInfo(response, &http_response_info); | 231 ReadHttpResponseInfo(response, &http_response_info); |
| 226 | 232 |
| 227 impl_->delegate_->DidReceiveManualResponse( | 233 impl_->delegate_->DidReceiveManualResponse( |
| 228 http_response_info.url, | 234 http_response_info.url, |
| 229 base::SysWideToNativeMB(http_response_info.mime_type), | 235 base::SysWideToNativeMB(http_response_info.mime_type), |
| 230 base::SysWideToNativeMB(impl_->GetAllHeaders(response)), | 236 base::SysWideToNativeMB(impl_->GetAllHeaders(response)), |
| 231 http_response_info.expected_length, | 237 http_response_info.expected_length, |
| 232 http_response_info.last_modified); | 238 http_response_info.last_modified); |
| 233 } | 239 } |
| 234 | 240 |
| 235 void WebPluginContainer::didReceiveData(const char *buffer, int length) { | 241 void WebPluginContainer::didReceiveData(const char *buffer, int length) { |
| 236 impl_->delegate_->DidReceiveManualData(buffer, length); | 242 impl_->delegate_->DidReceiveManualData(buffer, length); |
| 237 } | 243 } |
| 238 | 244 |
| 239 void WebPluginContainer::didFinishLoading() { | 245 void WebPluginContainer::didFinishLoading() { |
| 240 impl_->delegate_->DidFinishManualLoading(); | 246 impl_->delegate_->DidFinishManualLoading(); |
| 241 } | 247 } |
| 242 | 248 |
| 243 void WebPluginContainer::didFail(const WebCore::ResourceError&) { | 249 void WebPluginContainer::didFail(const WebCore::ResourceError&) { |
| 244 impl_->delegate_->DidManualLoadFail(); | 250 if (!ignore_response_error_) |
| 251 impl_->delegate_->DidManualLoadFail(); |
| 245 } | 252 } |
| 246 | 253 |
| 247 void WebPluginContainer::ReadHttpResponseInfo( | 254 void WebPluginContainer::ReadHttpResponseInfo( |
| 248 const WebCore::ResourceResponse& response, | 255 const WebCore::ResourceResponse& response, |
| 249 HttpResponseInfo* http_response) { | 256 HttpResponseInfo* http_response) { |
| 250 std::wstring url = webkit_glue::StringToStdWString(response.url().string()); | 257 std::wstring url = webkit_glue::StringToStdWString(response.url().string()); |
| 251 http_response->url = WideToASCII(url); | 258 http_response->url = WideToASCII(url); |
| 252 | 259 |
| 253 http_response->mime_type = | 260 http_response->mime_type = |
| 254 webkit_glue::StringToStdWString(response.mimeType()); | 261 webkit_glue::StringToStdWString(response.mimeType()); |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 false, false); | 1266 false, false); |
| 1260 if (!info.handle) { | 1267 if (!info.handle) { |
| 1261 return false; | 1268 return false; |
| 1262 } | 1269 } |
| 1263 | 1270 |
| 1264 clients_.push_back(info); | 1271 clients_.push_back(info); |
| 1265 return true; | 1272 return true; |
| 1266 } | 1273 } |
| 1267 | 1274 |
| 1268 void WebPluginImpl::CancelDocumentLoad() { | 1275 void WebPluginImpl::CancelDocumentLoad() { |
| 1269 frame()->loader()->stopLoading(false); | 1276 if (frame()->loader()->activeDocumentLoader()) { |
| 1277 widget_->set_ignore_response_error(true); |
| 1278 frame()->loader()->activeDocumentLoader()->stopLoading(); |
| 1279 } |
| 1270 } | 1280 } |
| 1271 | 1281 |
| 1272 void WebPluginImpl::InitiateHTTPRangeRequest(const char* url, | 1282 void WebPluginImpl::InitiateHTTPRangeRequest(const char* url, |
| 1273 const char* range_info, | 1283 const char* range_info, |
| 1274 HANDLE existing_stream, | 1284 HANDLE existing_stream, |
| 1275 bool notify_needed, | 1285 bool notify_needed, |
| 1276 HANDLE notify_data) { | 1286 HANDLE notify_data) { |
| 1277 int resource_id = GetNextResourceId(); | 1287 int resource_id = GetNextResourceId(); |
| 1278 std::string complete_url_string; | 1288 std::string complete_url_string; |
| 1279 CompleteURL(url, &complete_url_string); | 1289 CompleteURL(url, &complete_url_string); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1298 | 1308 |
| 1299 MultiPartResponseClient* multi_part_response_client = | 1309 MultiPartResponseClient* multi_part_response_client = |
| 1300 new MultiPartResponseClient(client); | 1310 new MultiPartResponseClient(client); |
| 1301 | 1311 |
| 1302 MultipartResponseDelegate* multi_part_response_handler = | 1312 MultipartResponseDelegate* multi_part_response_handler = |
| 1303 new MultipartResponseDelegate(multi_part_response_client, NULL, | 1313 new MultipartResponseDelegate(multi_part_response_client, NULL, |
| 1304 response, | 1314 response, |
| 1305 multipart_boundary); | 1315 multipart_boundary); |
| 1306 multi_part_response_map_[client] = multi_part_response_handler; | 1316 multi_part_response_map_[client] = multi_part_response_handler; |
| 1307 } | 1317 } |
| OLD | NEW |