| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel) | 105 IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel) |
| 106 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestForIOThread, | 106 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestForIOThread, |
| 107 OnExtensionRequestForIOThread) | 107 OnExtensionRequestForIOThread) |
| 108 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldUnloadAck, | 108 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ShouldUnloadAck, |
| 109 OnExtensionShouldUnloadAck) | 109 OnExtensionShouldUnloadAck) |
| 110 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GenerateUniqueID, | 110 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GenerateUniqueID, |
| 111 OnExtensionGenerateUniqueID) | 111 OnExtensionGenerateUniqueID) |
| 112 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UnloadAck, OnExtensionUnloadAck) | 112 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UnloadAck, OnExtensionUnloadAck) |
| 113 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ResumeRequests, | 113 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ResumeRequests, |
| 114 OnExtensionResumeRequests); | 114 OnExtensionResumeRequests); |
| 115 #if defined(USE_TCMALLOC) | |
| 116 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_WriteTcmallocHeapProfile_ACK, | |
| 117 OnWriteTcmallocHeapProfile) | |
| 118 #endif | |
| 119 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase) | 115 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase) |
| 120 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage) | 116 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage) |
| 121 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowFileSystem, OnAllowFileSystem) | 117 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowFileSystem, OnAllowFileSystem) |
| 122 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 118 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
| 123 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CanTriggerClipboardRead, | 119 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CanTriggerClipboardRead, |
| 124 OnCanTriggerClipboardRead) | 120 OnCanTriggerClipboardRead) |
| 125 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CanTriggerClipboardWrite, | 121 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CanTriggerClipboardWrite, |
| 126 OnCanTriggerClipboardWrite) | 122 OnCanTriggerClipboardWrite) |
| 127 IPC_MESSAGE_UNHANDLED(handled = false) | 123 IPC_MESSAGE_UNHANDLED(handled = false) |
| 128 IPC_END_MESSAGE_MAP() | 124 IPC_END_MESSAGE_MAP() |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 void ChromeRenderMessageFilter::OnExtensionGenerateUniqueID(int* unique_id) { | 462 void ChromeRenderMessageFilter::OnExtensionGenerateUniqueID(int* unique_id) { |
| 467 static int next_unique_id = 1; | 463 static int next_unique_id = 1; |
| 468 *unique_id = next_unique_id++; | 464 *unique_id = next_unique_id++; |
| 469 } | 465 } |
| 470 | 466 |
| 471 void ChromeRenderMessageFilter::OnExtensionResumeRequests(int route_id) { | 467 void ChromeRenderMessageFilter::OnExtensionResumeRequests(int route_id) { |
| 472 content::ResourceDispatcherHost::Get()->ResumeBlockedRequestsForRoute( | 468 content::ResourceDispatcherHost::Get()->ResumeBlockedRequestsForRoute( |
| 473 render_process_id_, route_id); | 469 render_process_id_, route_id); |
| 474 } | 470 } |
| 475 | 471 |
| 476 #if defined(USE_TCMALLOC) | |
| 477 void ChromeRenderMessageFilter::OnWriteTcmallocHeapProfile( | |
| 478 const FilePath::StringType& filepath, | |
| 479 const std::string& output) { | |
| 480 VLOG(0) << "Writing renderer heap profile dump to: " << filepath; | |
| 481 file_util::WriteFile(FilePath(filepath), output.c_str(), output.size()); | |
| 482 } | |
| 483 #endif | |
| 484 | |
| 485 void ChromeRenderMessageFilter::OnAllowDatabase(int render_view_id, | 472 void ChromeRenderMessageFilter::OnAllowDatabase(int render_view_id, |
| 486 const GURL& origin_url, | 473 const GURL& origin_url, |
| 487 const GURL& top_origin_url, | 474 const GURL& top_origin_url, |
| 488 const string16& name, | 475 const string16& name, |
| 489 const string16& display_name, | 476 const string16& display_name, |
| 490 bool* allowed) { | 477 bool* allowed) { |
| 491 *allowed = cookie_settings_->IsSettingCookieAllowed(origin_url, | 478 *allowed = cookie_settings_->IsSettingCookieAllowed(origin_url, |
| 492 top_origin_url); | 479 top_origin_url); |
| 493 BrowserThread::PostTask( | 480 BrowserThread::PostTask( |
| 494 BrowserThread::UI, FROM_HERE, | 481 BrowserThread::UI, FROM_HERE, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 556 |
| 570 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, | 557 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, |
| 571 const GURL& url, | 558 const GURL& url, |
| 572 const GURL& first_party_for_cookies, | 559 const GURL& first_party_for_cookies, |
| 573 const std::string& cookie) { | 560 const std::string& cookie) { |
| 574 #if defined(ENABLE_AUTOMATION) | 561 #if defined(ENABLE_AUTOMATION) |
| 575 AutomationResourceMessageFilter::SetCookiesForUrl( | 562 AutomationResourceMessageFilter::SetCookiesForUrl( |
| 576 render_process_id_, message.routing_id(), url, cookie); | 563 render_process_id_, message.routing_id(), url, cookie); |
| 577 #endif | 564 #endif |
| 578 } | 565 } |
| OLD | NEW |