Chromium Code Reviews| 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/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 rdh_->delegate()->OnResponseStarted( | 190 rdh_->delegate()->OnResponseStarted( |
| 191 request(), info->GetContext(), response, info->filter()); | 191 request(), info->GetContext(), response, info->filter()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); | 194 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); |
| 195 | 195 |
| 196 const HostZoomMap* host_zoom_map = info->filter()->GetHostZoomMap(); | 196 const HostZoomMap* host_zoom_map = info->filter()->GetHostZoomMap(); |
| 197 | 197 |
| 198 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { | 198 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME && host_zoom_map) { |
| 199 const GURL& request_url = request()->url(); | 199 const GURL& request_url = request()->url(); |
| 200 // TODO(wjmaclean): It would be nice if the AsyncResourceHandler didn't | |
| 201 // need to worry about whether a zoom level is temporary or not. Presumably | |
| 202 // this logic could move into HostZoomMap, in a function that is given | |
|
Charlie Reis
2015/02/11 18:34:31
+1 to moving this into a HostZoomMapImpl function.
wjmaclean
2015/02/11 20:29:34
Certainly. I wasn't sure about how much willingnes
| |
| 203 // all the necessary inputs. An alternative would be if we could pass the | |
| 204 // WebContents* for the navigating page from here, though that may change | |
|
Charlie Reis
2015/02/11 18:34:31
We can't pass a WebContents here, since this is on
wjmaclean
2015/02/11 20:29:34
Hadn't thought of that, so thanks for pointing it
| |
| 205 // the behaviour (e.g. navigations to a new origin will be handled | |
| 206 // properly too in that case). | |
| 207 int render_process_id = info->GetChildID(); | |
| 208 int render_view_id = info->GetRouteID(); | |
| 209 double zoom_level; | |
|
Charlie Reis
2015/02/11 18:34:31
nit: Initialize this.
wjmaclean
2015/02/11 20:29:34
Done.
| |
| 210 if (host_zoom_map->UsesTemporaryZoomLevel(render_process_id, | |
| 211 render_view_id)) { | |
| 212 zoom_level = host_zoom_map->GetTemporaryZoomLevel(render_process_id, | |
|
Charlie Reis
2015/02/11 18:34:31
Can we cast this to HostZoomMapImpl so that we don
wjmaclean
2015/02/11 20:29:34
Done.
| |
| 213 render_view_id); | |
| 214 } else { | |
| 215 zoom_level = host_zoom_map->GetZoomLevelForHostAndScheme( | |
| 216 request_url.scheme(), net::GetHostOrSpecFromURL(request_url)); | |
| 217 } | |
| 200 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( | 218 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( |
| 201 info->GetRouteID(), | 219 info->GetRouteID(), request_url, zoom_level)); |
| 202 request_url, host_zoom_map->GetZoomLevelForHostAndScheme( | |
| 203 request_url.scheme(), | |
| 204 net::GetHostOrSpecFromURL(request_url)))); | |
| 205 } | 220 } |
| 206 | 221 |
| 207 // If the parent handler downloaded the resource to a file, grant the child | 222 // If the parent handler downloaded the resource to a file, grant the child |
| 208 // read permissions on it. | 223 // read permissions on it. |
| 209 if (!response->head.download_file_path.empty()) { | 224 if (!response->head.download_file_path.empty()) { |
| 210 rdh_->RegisterDownloadedTempFile( | 225 rdh_->RegisterDownloadedTempFile( |
| 211 info->GetChildID(), info->GetRequestID(), | 226 info->GetChildID(), info->GetRequestID(), |
| 212 response->head.download_file_path); | 227 response->head.download_file_path); |
| 213 } | 228 } |
| 214 | 229 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 request()->LogUnblocked(); | 415 request()->LogUnblocked(); |
| 401 controller()->Resume(); | 416 controller()->Resume(); |
| 402 } | 417 } |
| 403 } | 418 } |
| 404 | 419 |
| 405 void AsyncResourceHandler::OnDefer() { | 420 void AsyncResourceHandler::OnDefer() { |
| 406 request()->LogBlockedBy("AsyncResourceHandler"); | 421 request()->LogBlockedBy("AsyncResourceHandler"); |
| 407 } | 422 } |
| 408 | 423 |
| 409 } // namespace content | 424 } // namespace content |
| OLD | NEW |