| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) | 664 IPC_BEGIN_MESSAGE_MAP_EX(BrowserRenderProcessHost, msg, msg_is_ok) |
| 665 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 665 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
| 666 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, | 666 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdatedCacheStats, |
| 667 OnUpdatedCacheStats) | 667 OnUpdatedCacheStats) |
| 668 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, | 668 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, |
| 669 SuddenTerminationChanged); | 669 SuddenTerminationChanged); |
| 670 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, | 670 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionAddListener, |
| 671 OnExtensionAddListener) | 671 OnExtensionAddListener) |
| 672 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, | 672 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRemoveListener, |
| 673 OnExtensionRemoveListener) | 673 OnExtensionRemoveListener) |
| 674 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel, |
| 675 OnExtensionCloseChannel) |
| 674 IPC_MESSAGE_UNHANDLED_ERROR() | 676 IPC_MESSAGE_UNHANDLED_ERROR() |
| 675 IPC_END_MESSAGE_MAP_EX() | 677 IPC_END_MESSAGE_MAP_EX() |
| 676 | 678 |
| 677 if (!msg_is_ok) { | 679 if (!msg_is_ok) { |
| 678 // The message had a handler, but its de-serialization failed. | 680 // The message had a handler, but its de-serialization failed. |
| 679 // We consider this a capital crime. Kill the renderer if we have one. | 681 // We consider this a capital crime. Kill the renderer if we have one. |
| 680 ReceivedBadMessage(msg.type()); | 682 ReceivedBadMessage(msg.type()); |
| 681 } | 683 } |
| 682 return; | 684 return; |
| 683 } | 685 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 } | 882 } |
| 881 default: { | 883 default: { |
| 882 NOTREACHED(); | 884 NOTREACHED(); |
| 883 break; | 885 break; |
| 884 } | 886 } |
| 885 } | 887 } |
| 886 } | 888 } |
| 887 | 889 |
| 888 void BrowserRenderProcessHost::OnExtensionAddListener( | 890 void BrowserRenderProcessHost::OnExtensionAddListener( |
| 889 const std::string& event_name) { | 891 const std::string& event_name) { |
| 890 URLRequestContext* context = profile()->GetRequestContext(); | 892 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 891 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 893 AddEventListener(event_name, pid()); |
| 892 ems->AddEventListener(event_name, pid()); | |
| 893 } | 894 } |
| 894 | 895 |
| 895 void BrowserRenderProcessHost::OnExtensionRemoveListener( | 896 void BrowserRenderProcessHost::OnExtensionRemoveListener( |
| 896 const std::string& event_name) { | 897 const std::string& event_name) { |
| 897 URLRequestContext* context = profile()->GetRequestContext(); | 898 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 898 ExtensionMessageService* ems = ExtensionMessageService::GetInstance(context); | 899 RemoveEventListener(event_name, pid()); |
| 899 ems->RemoveEventListener(event_name, pid()); | |
| 900 } | 900 } |
| 901 |
| 902 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 903 ExtensionMessageService::GetInstance(profile()->GetRequestContext())-> |
| 904 CloseChannel(port_id); |
| 905 } |
| OLD | NEW |