| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_message_handler.h" | 5 #include "chrome/browser/extensions/extension_message_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_message_service.h" | 7 #include "chrome/browser/extensions/extension_message_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/extensions/extension_messages.h" | 9 #include "chrome/common/extensions/extension_messages.h" |
| 10 #include "content/browser/child_process_security_policy.h" | 10 #include "content/browser/child_process_security_policy.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageHandler, message) | 26 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageHandler, message) |
| 27 IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnPostMessage) | 27 IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnPostMessage) |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) | 28 IPC_MESSAGE_UNHANDLED(handled = false) |
| 29 IPC_END_MESSAGE_MAP() | 29 IPC_END_MESSAGE_MAP() |
| 30 return handled; | 30 return handled; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ExtensionMessageHandler::RenderViewHostInitialized() { | 33 void ExtensionMessageHandler::RenderViewHostInitialized() { |
| 34 Send(new ExtensionMsg_NotifyRenderViewType( | 34 Send(new ExtensionMsg_NotifyRenderViewType( |
| 35 routing_id(), render_view_host()->delegate()->GetRenderViewType())); | 35 routing_id(), render_view_host()->delegate()->GetRenderViewType())); |
| 36 Send(new ExtensionMsg_UpdateBrowserWindowId( | |
| 37 routing_id(), render_view_host()->delegate()->GetBrowserWindowID())); | |
| 38 } | 36 } |
| 39 | 37 |
| 40 void ExtensionMessageHandler::OnPostMessage(int port_id, | 38 void ExtensionMessageHandler::OnPostMessage(int port_id, |
| 41 const std::string& message) { | 39 const std::string& message) { |
| 42 Profile* profile = render_view_host()->process()->profile(); | 40 Profile* profile = render_view_host()->process()->profile(); |
| 43 if (profile->GetExtensionMessageService()) { | 41 if (profile->GetExtensionMessageService()) { |
| 44 profile->GetExtensionMessageService()->PostMessageFromRenderer( | 42 profile->GetExtensionMessageService()->PostMessageFromRenderer( |
| 45 port_id, message); | 43 port_id, message); |
| 46 } | 44 } |
| 47 } | 45 } |
| OLD | NEW |