Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: chrome/browser/extensions/extension_message_handler.cc

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "content/browser/renderer_host/render_view_host.h" 11 #include "content/browser/renderer_host/render_view_host.h"
12 #include "content/browser/renderer_host/render_view_host_delegate.h" 12 #include "content/browser/renderer_host/render_view_host_delegate.h"
13 #include "content/browser/renderer_host/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 14
15 ExtensionMessageHandler::ExtensionMessageHandler( 15 ExtensionMessageHandler::ExtensionMessageHandler(
16 RenderViewHost* render_view_host) 16 RenderViewHost* render_view_host)
17 : RenderViewHostObserver(render_view_host) { 17 : RenderViewHostObserver(render_view_host) {
18 } 18 }
19 19
20 ExtensionMessageHandler::~ExtensionMessageHandler() { 20 ExtensionMessageHandler::~ExtensionMessageHandler() {
21 } 21 }
22 22
23 bool ExtensionMessageHandler::OnMessageReceived( 23 bool ExtensionMessageHandler::OnMessageReceived(
24 const IPC::Message& message) { 24 const IPC::Message& message) {
25 bool handled = true; 25 bool handled = true;
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 } 36 }
37 37
38 void ExtensionMessageHandler::OnPostMessage(int port_id, 38 void ExtensionMessageHandler::OnPostMessage(int port_id,
39 const std::string& message) { 39 const std::string& message) {
40 Profile* profile = Profile::FromBrowserContext( 40 Profile* profile = Profile::FromBrowserContext(
41 render_view_host()->process()->browser_context()); 41 render_view_host()->process()->GetBrowserContext());
42 if (profile->GetExtensionMessageService()) { 42 if (profile->GetExtensionMessageService()) {
43 profile->GetExtensionMessageService()->PostMessageFromRenderer( 43 profile->GetExtensionMessageService()->PostMessageFromRenderer(
44 port_id, message); 44 port_id, message);
45 } 45 }
46 } 46 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/extensions/extension_message_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698