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

Side by Side Diff: chrome/browser/renderer_host/resource_message_filter.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/resource_message_filter.h" 5 #include "chrome/browser/renderer_host/resource_message_filter.h"
6 6
7 #include "app/clipboard/clipboard.h" 7 #include "app/clipboard/clipboard.h"
8 #include "app/gfx/native_widget_types.h" 8 #include "app/gfx/native_widget_types.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/histogram.h" 11 #include "base/histogram.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/thread.h" 13 #include "base/thread.h"
14 #include "chrome/browser/browser_about_handler.h" 14 #include "chrome/browser/browser_about_handler.h"
15 #include "chrome/browser/child_process_security_policy.h" 15 #include "chrome/browser/child_process_security_policy.h"
16 #include "chrome/browser/chrome_plugin_browsing_context.h" 16 #include "chrome/browser/chrome_plugin_browsing_context.h"
17 #include "chrome/browser/chrome_thread.h" 17 #include "chrome/browser/chrome_thread.h"
18 #include "chrome/browser/extensions/extension_message_service.h" 18 #include "chrome/browser/extensions/extension_message_service.h"
19 #include "chrome/browser/host_zoom_map.h"
19 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" 20 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h"
20 #include "chrome/browser/nacl_process_host.h" 21 #include "chrome/browser/nacl_process_host.h"
21 #include "chrome/browser/net/chrome_url_request_context.h" 22 #include "chrome/browser/net/chrome_url_request_context.h"
22 #include "chrome/browser/net/dns_global.h" 23 #include "chrome/browser/net/dns_global.h"
23 #include "chrome/browser/notifications/desktop_notification_service.h" 24 #include "chrome/browser/notifications/desktop_notification_service.h"
24 #include "chrome/browser/notifications/notifications_prefs_cache.h" 25 #include "chrome/browser/notifications/notifications_prefs_cache.h"
25 #include "chrome/browser/plugin_service.h" 26 #include "chrome/browser/plugin_service.h"
26 #include "chrome/browser/profile.h"
27 #include "chrome/browser/privacy_blacklist/blacklist.h" 27 #include "chrome/browser/privacy_blacklist/blacklist.h"
28 #include "chrome/browser/privacy_blacklist/blacklist_ui.h" 28 #include "chrome/browser/privacy_blacklist/blacklist_ui.h"
29 #include "chrome/browser/profile.h"
29 #include "chrome/browser/renderer_host/audio_renderer_host.h" 30 #include "chrome/browser/renderer_host/audio_renderer_host.h"
30 #include "chrome/browser/renderer_host/browser_render_process_host.h" 31 #include "chrome/browser/renderer_host/browser_render_process_host.h"
31 #include "chrome/browser/renderer_host/database_dispatcher_host.h" 32 #include "chrome/browser/renderer_host/database_dispatcher_host.h"
32 #include "chrome/browser/renderer_host/render_widget_helper.h" 33 #include "chrome/browser/renderer_host/render_widget_helper.h"
33 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" 34 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h"
34 #include "chrome/browser/spellchecker_platform_engine.h" 35 #include "chrome/browser/spellchecker_platform_engine.h"
35 #include "chrome/browser/task_manager.h" 36 #include "chrome/browser/task_manager.h"
36 #include "chrome/browser/worker_host/message_port_dispatcher.h" 37 #include "chrome/browser/worker_host/message_port_dispatcher.h"
37 #include "chrome/browser/worker_host/worker_service.h" 38 #include "chrome/browser/worker_host/worker_service.h"
38 #include "chrome/common/appcache/appcache_dispatcher_host.h" 39 #include "chrome/common/appcache/appcache_dispatcher_host.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 PluginService* plugin_service, 149 PluginService* plugin_service,
149 printing::PrintJobManager* print_job_manager, 150 printing::PrintJobManager* print_job_manager,
150 Profile* profile, 151 Profile* profile,
151 RenderWidgetHelper* render_widget_helper, 152 RenderWidgetHelper* render_widget_helper,
152 URLRequestContextGetter* request_context) 153 URLRequestContextGetter* request_context)
153 : Receiver(RENDER_PROCESS, child_id), 154 : Receiver(RENDER_PROCESS, child_id),
154 channel_(NULL), 155 channel_(NULL),
155 resource_dispatcher_host_(resource_dispatcher_host), 156 resource_dispatcher_host_(resource_dispatcher_host),
156 plugin_service_(plugin_service), 157 plugin_service_(plugin_service),
157 print_job_manager_(print_job_manager), 158 print_job_manager_(print_job_manager),
159 profile_(profile),
158 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)), 160 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)),
159 request_context_(request_context), 161 request_context_(request_context),
160 media_request_context_(profile->GetRequestContextForMedia()), 162 media_request_context_(profile->GetRequestContextForMedia()),
161 extensions_request_context_(profile->GetRequestContextForExtensions()), 163 extensions_request_context_(profile->GetRequestContextForExtensions()),
162 extensions_message_service_(profile->GetExtensionMessageService()), 164 extensions_message_service_(profile->GetExtensionMessageService()),
163 profile_(profile),
164 render_widget_helper_(render_widget_helper), 165 render_widget_helper_(render_widget_helper),
165 audio_renderer_host_(audio_renderer_host), 166 audio_renderer_host_(audio_renderer_host),
166 appcache_dispatcher_host_( 167 appcache_dispatcher_host_(
167 new AppCacheDispatcherHost(profile->GetRequestContext())), 168 new AppCacheDispatcherHost(profile->GetRequestContext())),
168 ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_( 169 ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_(
169 new DOMStorageDispatcherHost(this, profile->GetWebKitContext(), 170 new DOMStorageDispatcherHost(this, profile->GetWebKitContext(),
170 resource_dispatcher_host->webkit_thread()))), 171 resource_dispatcher_host->webkit_thread()))),
171 ALLOW_THIS_IN_INITIALIZER_LIST(db_dispatcher_host_( 172 ALLOW_THIS_IN_INITIALIZER_LIST(db_dispatcher_host_(
172 new DatabaseDispatcherHost(profile->GetDatabaseTracker(), this))), 173 new DatabaseDispatcherHost(profile->GetDatabaseTracker(), this))),
173 notification_prefs_( 174 notification_prefs_(
174 profile->GetDesktopNotificationService()->prefs_cache()), 175 profile->GetDesktopNotificationService()->prefs_cache()),
175 socket_stream_dispatcher_host_(new SocketStreamDispatcherHost), 176 socket_stream_dispatcher_host_(new SocketStreamDispatcherHost),
177 host_zoom_map_(profile->GetHostZoomMap()),
176 off_the_record_(profile->IsOffTheRecord()), 178 off_the_record_(profile->IsOffTheRecord()),
177 next_route_id_callback_(NewCallbackWithReturnValue( 179 next_route_id_callback_(NewCallbackWithReturnValue(
178 render_widget_helper, &RenderWidgetHelper::GetNextRoutingID)) { 180 render_widget_helper, &RenderWidgetHelper::GetNextRoutingID)) {
179 DCHECK(request_context_); 181 DCHECK(request_context_);
180 DCHECK(media_request_context_); 182 DCHECK(media_request_context_);
181 DCHECK(audio_renderer_host_.get()); 183 DCHECK(audio_renderer_host_.get());
182 DCHECK(appcache_dispatcher_host_.get()); 184 DCHECK(appcache_dispatcher_host_.get());
183 DCHECK(dom_storage_dispatcher_host_.get()); 185 DCHECK(dom_storage_dispatcher_host_.get());
184 DCHECK(socket_stream_dispatcher_host_.get()); 186 DCHECK(socket_stream_dispatcher_host_.get());
185 187
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 OnAllocateTempFileForPrinting) 364 OnAllocateTempFileForPrinting)
363 IPC_MESSAGE_HANDLER(ViewHostMsg_TempFileForPrintingWritten, 365 IPC_MESSAGE_HANDLER(ViewHostMsg_TempFileForPrintingWritten,
364 OnTempFileForPrintingWritten) 366 OnTempFileForPrintingWritten)
365 #endif 367 #endif
366 #if defined(OS_MACOSX) 368 #if defined(OS_MACOSX)
367 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocatePDFTransport, 369 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocatePDFTransport,
368 OnAllocatePDFTransport) 370 OnAllocatePDFTransport)
369 #endif 371 #endif
370 IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats) 372 IPC_MESSAGE_HANDLER(ViewHostMsg_ResourceTypeStats, OnResourceTypeStats)
371 IPC_MESSAGE_HANDLER(ViewHostMsg_V8HeapStats, OnV8HeapStats) 373 IPC_MESSAGE_HANDLER(ViewHostMsg_V8HeapStats, OnV8HeapStats)
374 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomHost, OnDidZoomHost)
372 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ResolveProxy, OnResolveProxy) 375 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ResolveProxy, OnResolveProxy)
373 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDefaultPrintSettings, 376 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDefaultPrintSettings,
374 OnGetDefaultPrintSettings) 377 OnGetDefaultPrintSettings)
375 #if defined(OS_WIN) || defined(OS_MACOSX) 378 #if defined(OS_WIN) || defined(OS_MACOSX)
376 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint, 379 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint,
377 OnScriptedPrint) 380 OnScriptedPrint)
378 #endif 381 #endif
379 #if defined(OS_MACOSX) 382 #if defined(OS_MACOSX)
380 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, 383 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB,
381 OnAllocTransportDIB) 384 OnAllocTransportDIB)
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // static 839 // static
837 void ResourceMessageFilter::OnV8HeapStatsOnUIThread( 840 void ResourceMessageFilter::OnV8HeapStatsOnUIThread(
838 int v8_memory_allocated, int v8_memory_used, base::ProcessId renderer_id) { 841 int v8_memory_allocated, int v8_memory_used, base::ProcessId renderer_id) {
839 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 842 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
840 TaskManager::GetInstance()->model()->NotifyV8HeapStats( 843 TaskManager::GetInstance()->model()->NotifyV8HeapStats(
841 renderer_id, 844 renderer_id,
842 static_cast<size_t>(v8_memory_allocated), 845 static_cast<size_t>(v8_memory_allocated),
843 static_cast<size_t>(v8_memory_used)); 846 static_cast<size_t>(v8_memory_used));
844 } 847 }
845 848
849 void ResourceMessageFilter::OnDidZoomHost(const std::string& host,
850 int zoom_level) {
851 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
852 NewRunnableMethod(this,
853 &ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread,
854 host, zoom_level));
855 }
856
857 void ResourceMessageFilter::UpdateHostZoomLevelsOnUIThread(
858 const std::string& host,
859 int zoom_level) {
860 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
861 host_zoom_map_->SetZoomLevel(host, zoom_level);
862
863 // Notify renderers.
864 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
865 !i.IsAtEnd(); i.Advance()) {
866 RenderProcessHost* render_process_host = i.GetCurrentValue();
867 if (render_process_host->profile() == profile_) {
868 render_process_host->Send(
869 new ViewMsg_SetZoomLevelForCurrentHost(host, zoom_level));
870 }
871 }
872 }
873
846 void ResourceMessageFilter::OnResolveProxy(const GURL& url, 874 void ResourceMessageFilter::OnResolveProxy(const GURL& url,
847 IPC::Message* reply_msg) { 875 IPC::Message* reply_msg) {
848 resolve_proxy_msg_helper_.Start(url, reply_msg); 876 resolve_proxy_msg_helper_.Start(url, reply_msg);
849 } 877 }
850 878
851 void ResourceMessageFilter::OnResolveProxyCompleted( 879 void ResourceMessageFilter::OnResolveProxyCompleted(
852 IPC::Message* reply_msg, 880 IPC::Message* reply_msg,
853 int result, 881 int result,
854 const std::string& proxy_list) { 882 const std::string& proxy_list) {
855 ViewHostMsg_ResolveProxy::WriteReplyParams(reply_msg, result, proxy_list); 883 ViewHostMsg_ResolveProxy::WriteReplyParams(reply_msg, result, proxy_list);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 } 1177 }
1150 1178
1151 #if defined(USE_TCMALLOC) 1179 #if defined(USE_TCMALLOC)
1152 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, 1180 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid,
1153 const std::string& output) { 1181 const std::string& output) {
1154 ChromeThread::PostTask( 1182 ChromeThread::PostTask(
1155 ChromeThread::UI, FROM_HERE, 1183 ChromeThread::UI, FROM_HERE,
1156 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); 1184 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output));
1157 } 1185 }
1158 #endif 1186 #endif
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698