| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) | 634 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) |
| 635 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 635 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
| 636 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, | 636 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, |
| 637 OnUpdatedCacheStats) | 637 OnUpdatedCacheStats) |
| 638 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, | 638 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, |
| 639 SuddenTerminationChanged); | 639 SuddenTerminationChanged); |
| 640 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, | 640 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, |
| 641 OnExtensionAddListener) | 641 OnExtensionAddListener) |
| 642 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, | 642 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, |
| 643 OnExtensionRemoveListener) | 643 OnExtensionRemoveListener) |
| 644 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel, |
| 645 OnExtensionCloseChannel) |
| 644 IPC_MESSAGE_UNHANDLED_ERROR() | 646 IPC_MESSAGE_UNHANDLED_ERROR() |
| 645 IPC_END_MESSAGE_MAP_EX() | 647 IPC_END_MESSAGE_MAP_EX() |
| 646 | 648 |
| 647 if (!msg_is_ok) { | 649 if (!msg_is_ok) { |
| 648 // The message had a handler, but its de-serialization failed. | 650 // The message had a handler, but its de-serialization failed. |
| 649 // We consider this a capital crime. Kill the renderer if we have one. | 651 // We consider this a capital crime. Kill the renderer if we have one. |
| 650 ReceivedBadMessage(msg.type()); | 652 ReceivedBadMessage(msg.type()); |
| 651 } | 653 } |
| 652 return; | 654 return; |
| 653 } | 655 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 852 } |
| 851 default: { | 853 default: { |
| 852 NOTREACHED(); | 854 NOTREACHED(); |
| 853 break; | 855 break; |
| 854 } | 856 } |
| 855 } | 857 } |
| 856 } | 858 } |
| 857 | 859 |
| 858 void BrowserRenderProcessHost::OnExtensionAddListener( | 860 void BrowserRenderProcessHost::OnExtensionAddListener( |
| 859 const std::string& event_name) { | 861 const std::string& event_name) { |
| 860 URLRequestContext* context = profile()->GetRequestContext(); | 862 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 861 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 863 AddEventListener(event_name, pid()); |
| 862 ems->AddEventListener(event_name, pid()); | |
| 863 } | 864 } |
| 864 | 865 |
| 865 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 866 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
| 866 const std::string& event_name) { | 867 const std::string& event_name) { |
| 867 URLRequestContext* context = profile()->GetRequestContext(); | 868 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 868 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 869 RemoveEventListener(event_name, pid()); |
| 869 ems->RemoveEventListener(event_name, pid()); | |
| 870 } | 870 } |
| 871 |
| 872 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 873 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 874 CloseChannel(port_id); |
| 875 } |
| OLD | NEW |