| Index: content/browser/loader/async_resource_handler.cc
|
| diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
|
| index 599767b01c1292ee6c3e7360492d120262fe7a5b..0d4356f7e513878db5f0a8700eeec86826febba3 100644
|
| --- a/content/browser/loader/async_resource_handler.cc
|
| +++ b/content/browser/loader/async_resource_handler.cc
|
| @@ -7,6 +7,7 @@
|
| #include <algorithm>
|
| #include <vector>
|
|
|
| +#include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/containers/hash_tables.h"
|
| #include "base/debug/alias.h"
|
| @@ -26,6 +27,7 @@
|
| #include "content/browser/resource_context_impl.h"
|
| #include "content/common/resource_messages.h"
|
| #include "content/common/view_messages.h"
|
| +#include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/resource_dispatcher_host_delegate.h"
|
| #include "content/public/common/content_features.h"
|
| #include "content/public/common/resource_response.h"
|
| @@ -314,6 +316,33 @@ bool AsyncResourceHandler::OnRequestRedirected(
|
| GetRequestID(), redirect_info, response->head));
|
| }
|
|
|
| +namespace {
|
| +
|
| +// Defined here to be close to OnResponseStarted(), which is the only caller.
|
| +void SetZoomLevelForViewFromWebContents(
|
| + ResourceRequestInfo::WebContentsGetter request_web_contents_getter,
|
| + int render_process_id,
|
| + int render_view_id,
|
| + const GURL request_url) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +
|
| + WebContents* web_contents = request_web_contents_getter.Run();
|
| + if (!web_contents)
|
| + return;
|
| +
|
| + double zoom_level = HostZoomMap::GetZoomLevel(web_contents);
|
| +
|
| + RenderViewHost* render_view_host =
|
| + RenderViewHost::FromID(render_process_id, render_view_id);
|
| + if (!render_view_host)
|
| + return;
|
| +
|
| + render_view_host->Send(new ViewMsg_SetZoomLevelForLoadingURL(
|
| + render_view_id, request_url, zoom_level));
|
| +}
|
| +
|
| +} // namespace anonymous
|
| +
|
| bool AsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
|
| bool* defer) {
|
| // For changes to the main frame, inform the renderer of the new URL's
|
| @@ -357,6 +386,18 @@ bool AsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
|
|
|
| info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL(
|
| render_view_id, request_url, zoom_level));
|
| + } else if (info->GetResourceType() == RESOURCE_TYPE_SUB_FRAME &&
|
| + host_zoom_map) {
|
| + // Sub-frames should use the zoom level of their web-contents, regardless of
|
| + // their URL. We must access the WebContents on the UI thread.
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(
|
| + &SetZoomLevelForViewFromWebContents,
|
| + info->GetWebContentsGetterForRequest(),
|
| + info->GetChildID(),
|
| + info->GetRouteID(),
|
| + request()->url()));
|
| }
|
|
|
| // If the parent handler downloaded the resource to a file, grant the child
|
|
|