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

Unified Diff: chrome/browser/tab_contents/background_contents.cc

Issue 6794035: Move dispatching and sending of the last extension specific messages out of TabContents and Rende... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/background_contents.cc
===================================================================
--- chrome/browser/tab_contents/background_contents.cc (revision 80315)
+++ chrome/browser/tab_contents/background_contents.cc (working copy)
@@ -6,15 +6,16 @@
#include "chrome/browser/background_contents_service.h"
#include "chrome/browser/desktop_notification_handler.h"
+#include "chrome/browser/extensions/extension_message_handler.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
#include "chrome/common/extensions/extension_constants.h"
-#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/view_types.h"
#include "content/browser/browsing_instance.h"
+#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/common/notification_service.h"
@@ -45,6 +46,8 @@
Source<Profile>(profile));
desktop_notification_handler_.reset(
new DesktopNotificationHandler(NULL, site_instance->GetProcess()));
+ extension_message_handler_.reset(new ExtensionMessageHandler(
+ render_view_host_->process()->id(), render_view_host_, profile));
}
// Exposed to allow creating mocks.
@@ -198,16 +201,9 @@
}
bool BackgroundContents::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(BackgroundContents, message)
- IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnPostMessage)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- // Forward desktop notification IPCs if any to the
- // DesktopNotificationHandler.
+ bool handled = desktop_notification_handler_->OnMessageReceived(message);
if (!handled)
- handled = desktop_notification_handler_->OnMessageReceived(message);
+ handled = extension_message_handler_->OnMessageReceived(message);
return handled;
}
@@ -226,13 +222,6 @@
false); // is_web_ui
}
-void BackgroundContents::ProcessWebUIMessage(
- const ExtensionHostMsg_DomMessage_Params& params) {
- // TODO(rafaelw): It may make sense for extensions to be able to open
- // BackgroundContents to chrome-extension://<id> pages. Consider implementing.
- render_view_host_->BlockExtensionRequest(params.request_id);
-}
-
void BackgroundContents::CreateNewWindow(
int route_id,
const ViewHostMsg_CreateWindow_Params& params) {
@@ -285,12 +274,3 @@
return render_view_host->delegate()->GetAsBackgroundContents();
}
-
-void BackgroundContents::OnPostMessage(int port_id,
- const std::string& message) {
- Profile* profile = render_view_host_->process()->profile();
- if (profile->GetExtensionMessageService()) {
- profile->GetExtensionMessageService()->PostMessageFromRenderer(
- port_id, message);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698