| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/callback.h" | 8 #include "base/callback.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/appcache/appcache_dispatcher_host.h" | 14 #include "chrome/browser/appcache/appcache_dispatcher_host.h" |
| 15 #include "chrome/browser/browser_about_handler.h" | 15 #include "chrome/browser/browser_about_handler.h" |
| 16 #include "chrome/browser/child_process_security_policy.h" | 16 #include "chrome/browser/child_process_security_policy.h" |
| 17 #include "chrome/browser/chrome_plugin_browsing_context.h" | 17 #include "chrome/browser/chrome_plugin_browsing_context.h" |
| 18 #include "chrome/browser/chrome_thread.h" | 18 #include "chrome/browser/chrome_thread.h" |
| 19 #include "chrome/browser/download/download_file.h" | 19 #include "chrome/browser/download/download_file.h" |
| 20 #include "chrome/browser/extensions/extension_message_service.h" | 20 #include "chrome/browser/extensions/extension_message_service.h" |
| 21 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 21 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 22 #include "chrome/browser/geolocation/geolocation_dispatcher_host.h" | 22 #include "chrome/browser/geolocation/geolocation_dispatcher_host.h" |
| 23 #include "chrome/browser/gpu_process_host.h" |
| 23 #include "chrome/browser/host_zoom_map.h" | 24 #include "chrome/browser/host_zoom_map.h" |
| 24 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" | 25 #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" |
| 25 #include "chrome/browser/metrics/histogram_synchronizer.h" | 26 #include "chrome/browser/metrics/histogram_synchronizer.h" |
| 26 #include "chrome/browser/nacl_host/nacl_process_host.h" | 27 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 27 #include "chrome/browser/net/chrome_url_request_context.h" | 28 #include "chrome/browser/net/chrome_url_request_context.h" |
| 28 #include "chrome/browser/net/dns_global.h" | 29 #include "chrome/browser/net/dns_global.h" |
| 29 #include "chrome/browser/notifications/desktop_notification_service.h" | 30 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 30 #include "chrome/browser/notifications/notifications_prefs_cache.h" | 31 #include "chrome/browser/notifications/notifications_prefs_cache.h" |
| 31 #include "chrome/browser/plugin_service.h" | 32 #include "chrome/browser/plugin_service.h" |
| 32 #include "chrome/browser/pref_service.h" | 33 #include "chrome/browser/pref_service.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, OnGetFileSize) | 534 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileSize, OnGetFileSize) |
| 534 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileModificationTime, | 535 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetFileModificationTime, |
| 535 OnGetFileModificationTime) | 536 OnGetFileModificationTime) |
| 536 IPC_MESSAGE_HANDLER(ViewHostMsg_Keygen, OnKeygen) | 537 IPC_MESSAGE_HANDLER(ViewHostMsg_Keygen, OnKeygen) |
| 537 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetExtensionMessageBundle, | 538 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetExtensionMessageBundle, |
| 538 OnGetExtensionMessageBundle) | 539 OnGetExtensionMessageBundle) |
| 539 IPC_MESSAGE_HANDLER(ViewHostMsg_TranslateText, OnTranslateText) | 540 IPC_MESSAGE_HANDLER(ViewHostMsg_TranslateText, OnTranslateText) |
| 540 #if defined(USE_TCMALLOC) | 541 #if defined(USE_TCMALLOC) |
| 541 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) | 542 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererTcmalloc, OnRendererTcmalloc) |
| 542 #endif | 543 #endif |
| 544 IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel, |
| 545 OnEstablishGpuChannel) |
| 546 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu, |
| 547 OnSynchronizeGpu) |
| 543 IPC_MESSAGE_UNHANDLED( | 548 IPC_MESSAGE_UNHANDLED( |
| 544 handled = false) | 549 handled = false) |
| 545 IPC_END_MESSAGE_MAP_EX() | 550 IPC_END_MESSAGE_MAP_EX() |
| 546 } | 551 } |
| 547 | 552 |
| 548 if (!msg_is_ok) | 553 if (!msg_is_ok) |
| 549 BrowserRenderProcessHost::BadMessageTerminateProcess(msg.type(), handle()); | 554 BrowserRenderProcessHost::BadMessageTerminateProcess(msg.type(), handle()); |
| 550 | 555 |
| 551 return handled; | 556 return handled; |
| 552 } | 557 } |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 | 1409 |
| 1405 #if defined(USE_TCMALLOC) | 1410 #if defined(USE_TCMALLOC) |
| 1406 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, | 1411 void ResourceMessageFilter::OnRendererTcmalloc(base::ProcessId pid, |
| 1407 const std::string& output) { | 1412 const std::string& output) { |
| 1408 ChromeThread::PostTask( | 1413 ChromeThread::PostTask( |
| 1409 ChromeThread::UI, FROM_HERE, | 1414 ChromeThread::UI, FROM_HERE, |
| 1410 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); | 1415 NewRunnableFunction(AboutTcmallocRendererCallback, pid, output)); |
| 1411 } | 1416 } |
| 1412 #endif | 1417 #endif |
| 1413 | 1418 |
| 1419 void ResourceMessageFilter::OnEstablishGpuChannel() { |
| 1420 GpuProcessHost::Get()->EstablishGpuChannel(id(), this); |
| 1421 } |
| 1422 |
| 1423 void ResourceMessageFilter::OnSynchronizeGpu(IPC::Message* reply) { |
| 1424 // We handle this message (and the other GPU process messages) here |
| 1425 // rather than handing the message to the GpuProcessHost for |
| 1426 // dispatch so that we can use the DELAY_REPLY macro to synthesize |
| 1427 // the reply message, and also send down a "this" pointer so that |
| 1428 // the GPU process host can send the reply later. |
| 1429 GpuProcessHost::Get()->Synchronize(reply, this); |
| 1430 } |
| 1431 |
| 1414 void ResourceMessageFilter::OnGetExtensionMessageBundle( | 1432 void ResourceMessageFilter::OnGetExtensionMessageBundle( |
| 1415 const std::string& extension_id, IPC::Message* reply_msg) { | 1433 const std::string& extension_id, IPC::Message* reply_msg) { |
| 1416 ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>( | 1434 ChromeURLRequestContext* context = static_cast<ChromeURLRequestContext*>( |
| 1417 request_context_->GetURLRequestContext()); | 1435 request_context_->GetURLRequestContext()); |
| 1418 | 1436 |
| 1419 FilePath extension_path = context->GetPathForExtension(extension_id); | 1437 FilePath extension_path = context->GetPathForExtension(extension_id); |
| 1420 std::string default_locale = | 1438 std::string default_locale = |
| 1421 context->GetDefaultLocaleForExtension(extension_id); | 1439 context->GetDefaultLocaleForExtension(extension_id); |
| 1422 | 1440 |
| 1423 ChromeThread::PostTask( | 1441 ChromeThread::PostTask( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1451 dictionary_map.insert( | 1469 dictionary_map.insert( |
| 1452 std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id)); | 1470 std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id)); |
| 1453 | 1471 |
| 1454 ViewHostMsg_GetExtensionMessageBundle::WriteReplyParams( | 1472 ViewHostMsg_GetExtensionMessageBundle::WriteReplyParams( |
| 1455 reply_msg, dictionary_map); | 1473 reply_msg, dictionary_map); |
| 1456 | 1474 |
| 1457 ChromeThread::PostTask( | 1475 ChromeThread::PostTask( |
| 1458 ChromeThread::IO, FROM_HERE, | 1476 ChromeThread::IO, FROM_HERE, |
| 1459 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); | 1477 NewRunnableMethod(this, &ResourceMessageFilter::Send, reply_msg)); |
| 1460 } | 1478 } |
| OLD | NEW |