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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 it != request_map->end(); ++it) { | 1317 it != request_map->end(); ++it) { |
1317 DCHECK(it->second != NULL); | 1318 DCHECK(it->second != NULL); |
1318 it->second->Stop(); | 1319 it->second->Stop(); |
1319 } | 1320 } |
1320 request_map->clear(); | 1321 request_map->clear(); |
1321 | 1322 |
1322 if (request_map_lock) | 1323 if (request_map_lock) |
1323 request_map_lock->Release(); | 1324 request_map_lock->Release(); |
1324 } | 1325 } |
1325 | 1326 |
1326 void UrlmonUrlRequestManager::OnResponseStarted(int request_id, | 1327 void UrlmonUrlRequestManager::OnResponseStarted( |
1327 const char* mime_type, const char* headers, int size, | 1328 int request_id, const char* mime_type, const char* headers, int size, |
1328 base::Time last_modified, const std::string& redirect_url, | 1329 base::Time last_modified, const std::string& redirect_url, |
1329 int redirect_status, const net::HostPortPair& socket_address) { | 1330 int redirect_status, const net::HostPortPair& socket_address, |
| 1331 uint64 upload_size) { |
1330 DCHECK_NE(request_id, -1); | 1332 DCHECK_NE(request_id, -1); |
1331 DVLOG(1) << __FUNCTION__; | 1333 DVLOG(1) << __FUNCTION__; |
1332 | 1334 |
1333 #ifndef NDEBUG | 1335 #ifndef NDEBUG |
1334 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, | 1336 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, |
1335 &request_map_); | 1337 &request_map_); |
1336 if (request == NULL && background_worker_thread_enabled_) { | 1338 if (request == NULL && background_worker_thread_enabled_) { |
1337 base::AutoLock lock(background_resource_map_lock_); | 1339 base::AutoLock lock(background_resource_map_lock_); |
1338 request = LookupRequest(request_id, &background_request_map_); | 1340 request = LookupRequest(request_id, &background_request_map_); |
1339 } | 1341 } |
1340 DCHECK(request != NULL); | 1342 DCHECK(request != NULL); |
1341 #endif // NDEBUG | 1343 #endif // NDEBUG |
1342 delegate_->OnResponseStarted(request_id, mime_type, headers, size, | 1344 delegate_->OnResponseStarted( |
1343 last_modified, redirect_url, redirect_status, socket_address); | 1345 request_id, mime_type, headers, size, last_modified, redirect_url, |
| 1346 redirect_status, socket_address, upload_size); |
1344 } | 1347 } |
1345 | 1348 |
1346 void UrlmonUrlRequestManager::OnReadComplete(int request_id, | 1349 void UrlmonUrlRequestManager::OnReadComplete(int request_id, |
1347 const std::string& data) { | 1350 const std::string& data) { |
1348 DCHECK_NE(request_id, -1); | 1351 DCHECK_NE(request_id, -1); |
1349 DVLOG(1) << __FUNCTION__ << " id: " << request_id; | 1352 DVLOG(1) << __FUNCTION__ << " id: " << request_id; |
1350 #ifndef NDEBUG | 1353 #ifndef NDEBUG |
1351 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, | 1354 scoped_refptr<UrlmonUrlRequest> request = LookupRequest(request_id, |
1352 &request_map_); | 1355 &request_map_); |
1353 if (request == NULL && background_worker_thread_enabled_) { | 1356 if (request == NULL && background_worker_thread_enabled_) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 Stop(); | 1454 Stop(); |
1452 } | 1455 } |
1453 | 1456 |
1454 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { | 1457 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { |
1455 CoInitialize(NULL); | 1458 CoInitialize(NULL); |
1456 } | 1459 } |
1457 | 1460 |
1458 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { | 1461 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { |
1459 CoUninitialize(); | 1462 CoUninitialize(); |
1460 } | 1463 } |
OLD | NEW |