Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2525)

Unified Diff: chrome/browser/renderer_host/async_resource_handler.cc

Issue 437077: Remember zoom on a per-host basis.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/async_resource_handler.cc
===================================================================
--- chrome/browser/renderer_host/async_resource_handler.cc (revision 33695)
+++ chrome/browser/renderer_host/async_resource_handler.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,8 @@
#include "base/logging.h"
#include "base/process.h"
#include "base/shared_memory.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/common/render_messages.h"
#include "net/base/io_buffer.h"
@@ -97,6 +99,24 @@
bool AsyncResourceHandler::OnResponseStarted(int request_id,
ResourceResponse* response) {
+ // For changes to the main frame, inform the renderer of the new URL's zoom
+ // level before the request actually commits. This way the renderer will be
+ // able to set the zoom level precisely at the time the request commits,
+ // avoiding the possibility of zooming the old content or of having to layout
+ // the new content twice.
+ URLRequest* request = rdh_->GetURLRequest(
+ ResourceDispatcherHost::GlobalRequestID(process_id_, request_id));
+ ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request);
+ if (info->resource_type() == ResourceType::MAIN_FRAME) {
+ std::string host(request->url().host());
+ ChromeURLRequestContext* context =
+ static_cast<ChromeURLRequestContext*>(request->context());
+ if (!host.empty() && context) {
+ receiver_->Send(new ViewMsg_SetZoomLevelForLoadingHost(info->route_id(),
+ host, context->host_zoom_map()->GetZoomLevel(host)));
+ }
+ }
+
receiver_->Send(new ViewMsg_Resource_ReceivedResponse(
routing_id_, request_id, response->response_head));
return true;
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/browser/renderer_host/resource_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698