| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/clipboard.h" | 7 #include "base/clipboard.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/gfx/native_widget_types.h" | 9 #include "base/gfx/native_widget_types.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 channel_(NULL), | 140 channel_(NULL), |
| 141 resource_dispatcher_host_(resource_dispatcher_host), | 141 resource_dispatcher_host_(resource_dispatcher_host), |
| 142 plugin_service_(plugin_service), | 142 plugin_service_(plugin_service), |
| 143 print_job_manager_(print_job_manager), | 143 print_job_manager_(print_job_manager), |
| 144 render_process_id_(-1), | 144 render_process_id_(-1), |
| 145 spellchecker_(spellchecker), | 145 spellchecker_(spellchecker), |
| 146 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)), | 146 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)), |
| 147 request_context_(profile->GetRequestContext()), | 147 request_context_(profile->GetRequestContext()), |
| 148 media_request_context_(profile->GetRequestContextForMedia()), | 148 media_request_context_(profile->GetRequestContextForMedia()), |
| 149 extensions_request_context_(profile->GetRequestContextForExtensions()), | 149 extensions_request_context_(profile->GetRequestContextForExtensions()), |
| 150 extensions_message_service_(profile->GetExtensionMessageService()), |
| 150 profile_(profile), | 151 profile_(profile), |
| 151 render_widget_helper_(render_widget_helper), | 152 render_widget_helper_(render_widget_helper), |
| 152 audio_renderer_host_(audio_renderer_host), | 153 audio_renderer_host_(audio_renderer_host), |
| 153 app_cache_dispatcher_host_(new AppCacheDispatcherHost), | 154 app_cache_dispatcher_host_(new AppCacheDispatcherHost), |
| 154 ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_( | 155 ALLOW_THIS_IN_INITIALIZER_LIST(dom_storage_dispatcher_host_( |
| 155 new DOMStorageDispatcherHost(this, profile->GetWebKitContext(), | 156 new DOMStorageDispatcherHost(this, profile->GetWebKitContext(), |
| 156 resource_dispatcher_host->webkit_thread()))), | 157 resource_dispatcher_host->webkit_thread()))), |
| 157 off_the_record_(profile->IsOffTheRecord()) { | 158 off_the_record_(profile->IsOffTheRecord()) { |
| 158 DCHECK(request_context_.get()); | 159 DCHECK(request_context_.get()); |
| 159 DCHECK(request_context_->cookie_store()); | 160 DCHECK(request_context_->cookie_store()); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 OnScriptedPrint) | 328 OnScriptedPrint) |
| 328 #endif | 329 #endif |
| 329 #if defined(OS_MACOSX) | 330 #if defined(OS_MACOSX) |
| 330 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, | 331 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, |
| 331 OnAllocTransportDIB) | 332 OnAllocTransportDIB) |
| 332 IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, | 333 IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, |
| 333 OnFreeTransportDIB) | 334 OnFreeTransportDIB) |
| 334 #endif | 335 #endif |
| 335 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, | 336 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, |
| 336 OnOpenChannelToExtension) | 337 OnOpenChannelToExtension) |
| 338 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToTab, |
| 339 OnOpenChannelToTab) |
| 337 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseIdleConnections, | 340 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseIdleConnections, |
| 338 OnCloseIdleConnections) | 341 OnCloseIdleConnections) |
| 339 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, | 342 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCacheMode, |
| 340 OnSetCacheMode) | 343 OnSetCacheMode) |
| 341 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, | 344 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, |
| 342 OnGetFileSize) | 345 OnGetFileSize) |
| 343 | 346 |
| 344 IPC_MESSAGE_UNHANDLED( | 347 IPC_MESSAGE_UNHANDLED( |
| 345 handled = false) | 348 handled = false) |
| 346 IPC_END_MESSAGE_MAP_EX() | 349 IPC_END_MESSAGE_MAP_EX() |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 897 |
| 895 void ResourceMessageFilter::OnFreeTransportDIB( | 898 void ResourceMessageFilter::OnFreeTransportDIB( |
| 896 TransportDIB::Id dib_id) { | 899 TransportDIB::Id dib_id) { |
| 897 render_widget_helper_->FreeTransportDIB(dib_id); | 900 render_widget_helper_->FreeTransportDIB(dib_id); |
| 898 } | 901 } |
| 899 #endif | 902 #endif |
| 900 | 903 |
| 901 void ResourceMessageFilter::OnOpenChannelToExtension( | 904 void ResourceMessageFilter::OnOpenChannelToExtension( |
| 902 int routing_id, const std::string& extension_id, | 905 int routing_id, const std::string& extension_id, |
| 903 const std::string& channel_name, int* port_id) { | 906 const std::string& channel_name, int* port_id) { |
| 904 *port_id = ExtensionMessageService::GetInstance(request_context_.get())-> | 907 if (extensions_message_service_.get()) { |
| 905 OpenChannelToExtension(routing_id, extension_id, channel_name, this); | 908 *port_id = extensions_message_service_-> |
| 909 OpenChannelToExtension(routing_id, extension_id, channel_name, this); |
| 910 } else { |
| 911 *port_id = -1; |
| 912 } |
| 913 } |
| 914 |
| 915 void ResourceMessageFilter::OnOpenChannelToTab( |
| 916 int routing_id, int tab_id, const std::string& extension_id, |
| 917 const std::string& channel_name, int* port_id) { |
| 918 if (extensions_message_service_.get()) { |
| 919 *port_id = extensions_message_service_-> |
| 920 OpenChannelToTab(routing_id, tab_id, extension_id, channel_name, this); |
| 921 } else { |
| 922 *port_id = -1; |
| 923 } |
| 906 } | 924 } |
| 907 | 925 |
| 908 bool ResourceMessageFilter::CheckBenchmarkingEnabled() { | 926 bool ResourceMessageFilter::CheckBenchmarkingEnabled() { |
| 909 static bool checked = false; | 927 static bool checked = false; |
| 910 static bool result = false; | 928 static bool result = false; |
| 911 if (!checked) { | 929 if (!checked) { |
| 912 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 930 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 913 result = command_line.HasSwitch(switches::kEnableBenchmarking); | 931 result = command_line.HasSwitch(switches::kEnableBenchmarking); |
| 914 checked = true; | 932 checked = true; |
| 915 } | 933 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 } | 974 } |
| 957 | 975 |
| 958 void ResourceMessageFilter::ReplyGetFileSize(int64 result, void* param) { | 976 void ResourceMessageFilter::ReplyGetFileSize(int64 result, void* param) { |
| 959 IPC::Message* reply_msg = static_cast<IPC::Message*>(param); | 977 IPC::Message* reply_msg = static_cast<IPC::Message*>(param); |
| 960 ViewHostMsg_GetFileSize::WriteReplyParams(reply_msg, result); | 978 ViewHostMsg_GetFileSize::WriteReplyParams(reply_msg, result); |
| 961 Send(reply_msg); | 979 Send(reply_msg); |
| 962 | 980 |
| 963 // Getting file size callback done, decrease the ref count. | 981 // Getting file size callback done, decrease the ref count. |
| 964 Release(); | 982 Release(); |
| 965 } | 983 } |
| OLD | NEW |