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/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/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 bool handled = true; | 24 bool handled = true; |
25 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageHandler, message) | 25 IPC_BEGIN_MESSAGE_MAP(ExtensionMessageHandler, message) |
26 IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnPostMessage) | 26 IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnPostMessage) |
27 IPC_MESSAGE_UNHANDLED(handled = false) | 27 IPC_MESSAGE_UNHANDLED(handled = false) |
28 IPC_END_MESSAGE_MAP() | 28 IPC_END_MESSAGE_MAP() |
29 return handled; | 29 return handled; |
30 } | 30 } |
31 | 31 |
32 void ExtensionMessageHandler::RenderViewHostInitialized() { | 32 void ExtensionMessageHandler::RenderViewHostInitialized() { |
33 Send(new ExtensionMsg_NotifyRenderViewType( | 33 Send(new ExtensionMsg_NotifyRenderViewType( |
34 routing_id(), render_view_host()->delegate()->GetRenderViewType())); | 34 routing_id(), render_view_host()->GetDelegate()->GetRenderViewType())); |
35 } | 35 } |
36 | 36 |
37 void ExtensionMessageHandler::OnPostMessage(int port_id, | 37 void ExtensionMessageHandler::OnPostMessage(int port_id, |
38 const std::string& message) { | 38 const std::string& message) { |
39 Profile* profile = Profile::FromBrowserContext( | 39 Profile* profile = Profile::FromBrowserContext( |
40 render_view_host()->process()->GetBrowserContext()); | 40 render_view_host()->GetProcess()->GetBrowserContext()); |
41 if (profile->GetExtensionMessageService()) { | 41 if (profile->GetExtensionMessageService()) { |
42 profile->GetExtensionMessageService()->PostMessageFromRenderer( | 42 profile->GetExtensionMessageService()->PostMessageFromRenderer( |
43 port_id, message); | 43 port_id, message); |
44 } | 44 } |
45 } | 45 } |
OLD | NEW |