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 #include "chrome_frame/urlmon_url_request.h" | 5 #include "chrome_frame/urlmon_url_request.h" |
6 | 6 |
7 #include <urlmon.h> | 7 #include <urlmon.h> |
8 #include <wininet.h> | 8 #include <wininet.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 return E_FAIL; | 684 return E_FAIL; |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
688 DVLOG(1) << __FUNCTION__ << me() << "Calling OnResponseStarted"; | 688 DVLOG(1) << __FUNCTION__ << me() << "Calling OnResponseStarted"; |
689 | 689 |
690 // Inform the delegate. | 690 // Inform the delegate. |
691 headers_received_ = true; | 691 headers_received_ = true; |
692 DCHECK_NE(id(), -1); | 692 DCHECK_NE(id(), -1); |
693 delegate_->OnResponseStarted(id(), | 693 delegate_->OnResponseStarted(id(), |
694 "", // mime_type | 694 "", // mime_type |
695 raw_headers.c_str(), // headers | 695 raw_headers.c_str(), // headers |
696 0, // size | 696 0, // size |
697 base::Time(), // last_modified | 697 base::Time(), // last_modified |
698 status_.get_redirection().utf8_url, | 698 status_.get_redirection().utf8_url, |
699 status_.get_redirection().http_code, | 699 status_.get_redirection().http_code, |
700 socket_address_); | 700 socket_address_, |
| 701 post_data_len()); |
701 return S_OK; | 702 return S_OK; |
702 } | 703 } |
703 | 704 |
704 STDMETHODIMP UrlmonUrlRequest::GetWindow(const GUID& guid_reason, | 705 STDMETHODIMP UrlmonUrlRequest::GetWindow(const GUID& guid_reason, |
705 HWND* parent_window) { | 706 HWND* parent_window) { |
706 if (!parent_window) | 707 if (!parent_window) |
707 return E_INVALIDARG; | 708 return E_INVALIDARG; |
708 | 709 |
709 #ifndef NDEBUG | 710 #ifndef NDEBUG |
710 wchar_t guid[40] = {0}; | 711 wchar_t guid[40] = {0}; |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 it != request_map->end(); ++it) { | 1292 it != request_map->end(); ++it) { |
1292 DCHECK(it->second != NULL); | 1293 DCHECK(it->second != NULL); |
1293 it->second->Stop(); | 1294 it->second->Stop(); |
1294 } | 1295 } |
1295 request_map->clear(); | 1296 request_map->clear(); |
1296 | 1297 |
1297 if (request_map_lock) | 1298 if (request_map_lock) |
1298 request_map_lock->Release(); | 1299 request_map_lock->Release(); |
1299 } | 1300 } |
1300 | 1301 |
1301 void UrlmonUrlRequestManager::OnResponseStarted(int request_id, | 1302 void UrlmonUrlRequestManager::OnResponseStarted( |
1302 const char* mime_type, const char* headers, int size, | 1303 int request_id, const char* mime_type, const char* headers, int size, |
1303 base::Time last_modified, const std::string& redirect_url, | 1304 base::Time last_modified, const std::string& redirect_url, |
1304 int redirect_status, const net::HostPortPair& socket_address) { | 1305 int redirect_status, const net::HostPortPair& socket_address, |
| 1306 uint64 upload_size) { |
1305 DCHECK_NE(request_id, -1); | 1307 DCHECK_NE(request_id, -1); |
1306 DVLOG(1) << __FUNCTION__; | 1308 DVLOG(1) << __FUNCTION__; |
1307 | 1309 |
1308 #ifndef NDEBUG | 1310 #ifndef NDEBUG |
1309 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, | 1311 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, |
1310 &request_map_); | 1312 &request_map_); |
1311 if (request == NULL && background_worker_thread_enabled_) { | 1313 if (request == NULL && background_worker_thread_enabled_) { |
1312 base::AutoLock lock(background_resource_map_lock_); | 1314 base::AutoLock lock(background_resource_map_lock_); |
1313 request = LookupRequest(request_id, &background_request_map_); | 1315 request = LookupRequest(request_id, &background_request_map_); |
1314 } | 1316 } |
1315 DCHECK(request != NULL); | 1317 DCHECK(request != NULL); |
1316 #endif // NDEBUG | 1318 #endif // NDEBUG |
1317 delegate_->OnResponseStarted(request_id, mime_type, headers, size, | 1319 delegate_->OnResponseStarted( |
1318 last_modified, redirect_url, redirect_status, socket_address); | 1320 request_id, mime_type, headers, size, last_modified, redirect_url, |
| 1321 redirect_status, socket_address, upload_size); |
1319 } | 1322 } |
1320 | 1323 |
1321 void UrlmonUrlRequestManager::OnReadComplete(int request_id, | 1324 void UrlmonUrlRequestManager::OnReadComplete(int request_id, |
1322 const std::string& data) { | 1325 const std::string& data) { |
1323 DCHECK_NE(request_id, -1); | 1326 DCHECK_NE(request_id, -1); |
1324 DVLOG(1) << __FUNCTION__ << " id: " << request_id; | 1327 DVLOG(1) << __FUNCTION__ << " id: " << request_id; |
1325 #ifndef NDEBUG | 1328 #ifndef NDEBUG |
1326 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, | 1329 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, |
1327 &request_map_); | 1330 &request_map_); |
1328 if (request == NULL && background_worker_thread_enabled_) { | 1331 if (request == NULL && background_worker_thread_enabled_) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 Stop(); | 1429 Stop(); |
1427 } | 1430 } |
1428 | 1431 |
1429 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { | 1432 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { |
1430 CoInitialize(NULL); | 1433 CoInitialize(NULL); |
1431 } | 1434 } |
1432 | 1435 |
1433 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { | 1436 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { |
1434 CoUninitialize(); | 1437 CoUninitialize(); |
1435 } | 1438 } |
OLD | NEW |