| OLD | NEW |
| 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" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 #endif | 303 #endif |
| 304 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) | 304 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins) |
| 305 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPath, OnGetPluginPath) | 305 IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginPath, OnGetPluginPath) |
| 306 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) | 306 IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl) |
| 307 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ContextMenu, | 307 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ContextMenu, |
| 308 OnReceiveContextMenuMsg(msg)) | 308 OnReceiveContextMenuMsg(msg)) |
| 309 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPlugin, | 309 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPlugin, |
| 310 OnOpenChannelToPlugin) | 310 OnOpenChannelToPlugin) |
| 311 IPC_MESSAGE_HANDLER(ViewHostMsg_LaunchNaCl, OnLaunchNaCl) | 311 IPC_MESSAGE_HANDLER(ViewHostMsg_LaunchNaCl, OnLaunchNaCl) |
| 312 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWorker, OnCreateWorker) | 312 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWorker, OnCreateWorker) |
| 313 IPC_MESSAGE_HANDLER(ViewHostMsg_LookupSharedWorker, OnLookupSharedWorker) |
| 314 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentDetached, OnDocumentDetached) |
| 313 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelCreateDedicatedWorker, | 315 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelCreateDedicatedWorker, |
| 314 OnCancelCreateDedicatedWorker) | 316 OnCancelCreateDedicatedWorker) |
| 315 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker, | 317 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker, |
| 316 OnForwardToWorker) | 318 OnForwardToWorker) |
| 317 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SpellCheck, OnSpellCheck) | 319 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SpellCheck, OnSpellCheck) |
| 318 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDocumentTag, | 320 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDocumentTag, |
| 319 OnGetDocumentTag) | 321 OnGetDocumentTag) |
| 320 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentWithTagClosed, | 322 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentWithTagClosed, |
| 321 OnDocumentWithTagClosed) | 323 OnDocumentWithTagClosed) |
| 322 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetAutoCorrectWord, | 324 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetAutoCorrectWord, |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 nacl_process_id); | 649 nacl_process_id); |
| 648 } | 650 } |
| 649 | 651 |
| 650 void ResourceMessageFilter::OnCreateWorker(const GURL& url, | 652 void ResourceMessageFilter::OnCreateWorker(const GURL& url, |
| 651 bool is_shared, | 653 bool is_shared, |
| 652 const string16& name, | 654 const string16& name, |
| 653 int render_view_route_id, | 655 int render_view_route_id, |
| 654 int* route_id) { | 656 int* route_id) { |
| 655 *route_id = render_widget_helper_->GetNextRoutingID(); | 657 *route_id = render_widget_helper_->GetNextRoutingID(); |
| 656 WorkerService::GetInstance()->CreateWorker( | 658 WorkerService::GetInstance()->CreateWorker( |
| 657 url, is_shared, name, id(), render_view_route_id, this, id(), *route_id); | 659 url, is_shared, name, id(), render_view_route_id, this, *route_id); |
| 660 } |
| 661 |
| 662 void ResourceMessageFilter::OnLookupSharedWorker(const GURL& url, |
| 663 const string16& name, |
| 664 unsigned long long document_id, |
| 665 int* route_id, |
| 666 bool* url_mismatch) { |
| 667 int new_route_id = render_widget_helper_->GetNextRoutingID(); |
| 668 bool worker_found = WorkerService::GetInstance()->LookupSharedWorker( |
| 669 url, name, document_id, this, new_route_id, url_mismatch); |
| 670 *route_id = worker_found ? new_route_id : MSG_ROUTING_NONE; |
| 671 } |
| 672 |
| 673 void ResourceMessageFilter::OnDocumentDetached(unsigned long long document_id) { |
| 674 // Notify the WorkerService that the passed document was detached so any |
| 675 // associated shared workers can be shut down. |
| 676 WorkerService::GetInstance()->DocumentDetached(this, document_id); |
| 658 } | 677 } |
| 659 | 678 |
| 660 void ResourceMessageFilter::OnCancelCreateDedicatedWorker(int route_id) { | 679 void ResourceMessageFilter::OnCancelCreateDedicatedWorker(int route_id) { |
| 661 WorkerService::GetInstance()->CancelCreateDedicatedWorker(id(), route_id); | 680 WorkerService::GetInstance()->CancelCreateDedicatedWorker(this, route_id); |
| 662 } | 681 } |
| 663 | 682 |
| 664 void ResourceMessageFilter::OnForwardToWorker(const IPC::Message& message) { | 683 void ResourceMessageFilter::OnForwardToWorker(const IPC::Message& message) { |
| 665 WorkerService::GetInstance()->ForwardMessage(message, id()); | 684 WorkerService::GetInstance()->ForwardMessage(message, this); |
| 666 } | 685 } |
| 667 | 686 |
| 668 void ResourceMessageFilter::OnDownloadUrl(const IPC::Message& message, | 687 void ResourceMessageFilter::OnDownloadUrl(const IPC::Message& message, |
| 669 const GURL& url, | 688 const GURL& url, |
| 670 const GURL& referrer) { | 689 const GURL& referrer) { |
| 671 URLRequestContext* context = request_context_->GetURLRequestContext(); | 690 URLRequestContext* context = request_context_->GetURLRequestContext(); |
| 672 resource_dispatcher_host_->BeginDownload(url, | 691 resource_dispatcher_host_->BeginDownload(url, |
| 673 referrer, | 692 referrer, |
| 674 id(), | 693 id(), |
| 675 message.routing_id(), | 694 message.routing_id(), |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 } | 1224 } |
| 1206 | 1225 |
| 1207 #if defined(USE_TCMALLOC) | 1226 #if defined(USE_TCMALLOC) |
| 1208 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, | 1227 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, |
| 1209 const std::string& output) { | 1228 const std::string& output) { |
| 1210 ChromeThread::PostTask( | 1229 ChromeThread::PostTask( |
| 1211 ChromeThread::UI, FROM_HERE, | 1230 ChromeThread::UI, FROM_HERE, |
| 1212 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); | 1231 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); |
| 1213 } | 1232 } |
| 1214 #endif | 1233 #endif |
| OLD | NEW |