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 "content/browser/loader/sync_resource_handler.h" | 5 #include "content/browser/loader/sync_resource_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/devtools/devtools_netlog_observer.h" | 8 #include "content/browser/devtools/devtools_netlog_observer.h" |
9 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 9 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
10 #include "content/browser/loader/resource_message_filter.h" | 10 #include "content/browser/loader/resource_message_filter.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (!info->filter()) | 76 if (!info->filter()) |
77 return false; | 77 return false; |
78 | 78 |
79 if (rdh_->delegate()) { | 79 if (rdh_->delegate()) { |
80 rdh_->delegate()->OnResponseStarted( | 80 rdh_->delegate()->OnResponseStarted( |
81 request(), info->GetContext(), response, info->filter()); | 81 request(), info->GetContext(), response, info->filter()); |
82 } | 82 } |
83 | 83 |
84 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); | 84 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); |
85 | 85 |
| 86 // If the parent handler downloaded the resource to a file, grant the child |
| 87 // read permissions on it. Note: there is similar logic in |
| 88 // AsyncResourceHandler. |
| 89 // |
| 90 // TODO(davidben): Can we remove support for download_file in sync requests |
| 91 // altogether? I don't think Blink ever makes such requests. |
| 92 if (!response->head.download_file_path.empty()) { |
| 93 rdh_->RegisterDownloadedTempFile( |
| 94 info->GetChildID(), info->GetRequestID(), |
| 95 response->head.download_file_path); |
| 96 } |
| 97 |
86 // We don't care about copying the status here. | 98 // We don't care about copying the status here. |
87 result_.headers = response->head.headers; | 99 result_.headers = response->head.headers; |
88 result_.mime_type = response->head.mime_type; | 100 result_.mime_type = response->head.mime_type; |
89 result_.charset = response->head.charset; | 101 result_.charset = response->head.charset; |
90 result_.download_file_path = response->head.download_file_path; | 102 result_.download_file_path = response->head.download_file_path; |
91 result_.request_time = response->head.request_time; | 103 result_.request_time = response->head.request_time; |
92 result_.response_time = response->head.response_time; | 104 result_.response_time = response->head.response_time; |
93 result_.load_timing = response->head.load_timing; | 105 result_.load_timing = response->head.load_timing; |
94 result_.devtools_info = response->head.devtools_info; | 106 result_.devtools_info = response->head.devtools_info; |
95 return true; | 107 return true; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 158 } |
147 | 159 |
148 void SyncResourceHandler::OnDataDownloaded( | 160 void SyncResourceHandler::OnDataDownloaded( |
149 int request_id, | 161 int request_id, |
150 int bytes_downloaded) { | 162 int bytes_downloaded) { |
151 // Sync requests don't involve ResourceMsg_DataDownloaded messages | 163 // Sync requests don't involve ResourceMsg_DataDownloaded messages |
152 // being sent back to renderers as progress is made. | 164 // being sent back to renderers as progress is made. |
153 } | 165 } |
154 | 166 |
155 } // namespace content | 167 } // namespace content |
OLD | NEW |