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 // See http://wiki.corp.google.com/twiki/bin/view/Main/ChromeMultiProcessResourc
eLoading | 5 // See http://wiki.corp.google.com/twiki/bin/view/Main/ChromeMultiProcessResourc
eLoading |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/resource_dispatcher_host.h" | 9 #include "chrome/browser/resource_dispatcher_host.h" |
10 | 10 |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 | 1602 |
1603 // We are explicitly forcing the download of 'url'. | 1603 // We are explicitly forcing the download of 'url'. |
1604 void ResourceDispatcherHost::BeginDownload(const GURL& url, | 1604 void ResourceDispatcherHost::BeginDownload(const GURL& url, |
1605 const GURL& referrer, | 1605 const GURL& referrer, |
1606 int render_process_host_id, | 1606 int render_process_host_id, |
1607 int render_view_id, | 1607 int render_view_id, |
1608 URLRequestContext* request_context) { | 1608 URLRequestContext* request_context) { |
1609 if (is_shutdown_) | 1609 if (is_shutdown_) |
1610 return; | 1610 return; |
1611 | 1611 |
| 1612 if (!URLRequest::IsHandledURL(url)) |
| 1613 return; |
| 1614 |
1612 // Check if the renderer is permitted to request the requested URL. | 1615 // Check if the renderer is permitted to request the requested URL. |
1613 // | 1616 // |
1614 // TODO(mpcomplete): remove "render_process_host_id != -1" | 1617 // TODO(mpcomplete): remove "render_process_host_id != -1" |
1615 // when http://b/viewIssue?id=1080959 is fixed. | 1618 // when http://b/viewIssue?id=1080959 is fixed. |
1616 if (render_process_host_id != -1 && | 1619 if (render_process_host_id != -1 && |
1617 !RendererSecurityPolicy::GetInstance()-> | 1620 !RendererSecurityPolicy::GetInstance()-> |
1618 CanRequestURL(render_process_host_id, url)) { | 1621 CanRequestURL(render_process_host_id, url)) { |
1619 LOG(INFO) << "Denied unauthorized download request for " << | 1622 LOG(INFO) << "Denied unauthorized download request for " << |
1620 url.possibly_invalid_spec(); | 1623 url.possibly_invalid_spec(); |
1621 return; | 1624 return; |
(...skipping 20 matching lines...) Expand all Loading... |
1642 if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(url)) { | 1645 if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(url)) { |
1643 handler = new SafeBrowsingEventHandler(handler, | 1646 handler = new SafeBrowsingEventHandler(handler, |
1644 render_process_host_id, | 1647 render_process_host_id, |
1645 render_view_id, | 1648 render_view_id, |
1646 url, | 1649 url, |
1647 ResourceType::MAIN_FRAME, | 1650 ResourceType::MAIN_FRAME, |
1648 safe_browsing_, | 1651 safe_browsing_, |
1649 this); | 1652 this); |
1650 } | 1653 } |
1651 | 1654 |
1652 bool known_proto = URLRequest::IsHandledURL(url); | |
1653 if (!known_proto) { | |
1654 CHECK(false); | |
1655 } | |
1656 | |
1657 request->set_method("GET"); | 1655 request->set_method("GET"); |
1658 request->set_referrer(referrer.spec()); | 1656 request->set_referrer(referrer.spec()); |
1659 request->set_context(request_context); | 1657 request->set_context(request_context); |
1660 | 1658 |
1661 ExtraRequestInfo* extra_info = | 1659 ExtraRequestInfo* extra_info = |
1662 new ExtraRequestInfo(handler, | 1660 new ExtraRequestInfo(handler, |
1663 request_id_, | 1661 request_id_, |
1664 render_process_host_id, | 1662 render_process_host_id, |
1665 render_view_id, | 1663 render_view_id, |
1666 false, // Downloads are not considered mixed-content | 1664 false, // Downloads are not considered mixed-content |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements)); | 2508 bool enough_new_progress = (amt_since_last > (size / kHalfPercentIncrements)); |
2511 bool too_much_time_passed = time_since_last > kOneSecond; | 2509 bool too_much_time_passed = time_since_last > kOneSecond; |
2512 | 2510 |
2513 if (is_finished || enough_new_progress || too_much_time_passed) { | 2511 if (is_finished || enough_new_progress || too_much_time_passed) { |
2514 info->event_handler->OnUploadProgress(info->request_id, position, size); | 2512 info->event_handler->OnUploadProgress(info->request_id, position, size); |
2515 info->waiting_for_upload_progress_ack = true; | 2513 info->waiting_for_upload_progress_ack = true; |
2516 info->last_upload_ticks = TimeTicks::Now(); | 2514 info->last_upload_ticks = TimeTicks::Now(); |
2517 info->last_upload_position = position; | 2515 info->last_upload_position = position; |
2518 } | 2516 } |
2519 } | 2517 } |
OLD | NEW |