summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/chrome_notification_observer.cc25
-rw-r--r--chrome/browser/extensions/chrome_notification_observer.h6
-rw-r--r--extensions/DEPS1
-rw-r--r--extensions/browser/renderer_startup_helper.cc5
-rw-r--r--extensions/browser/renderer_startup_helper.h2
5 files changed, 30 insertions, 9 deletions
diff --git a/chrome/browser/extensions/chrome_notification_observer.cc b/chrome/browser/extensions/chrome_notification_observer.cc
index 0289715..5d966c8 100644
--- a/chrome/browser/extensions/chrome_notification_observer.cc
+++ b/chrome/browser/extensions/chrome_notification_observer.cc
@@ -8,16 +8,23 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/common/extensions/features/feature_channel.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_process_host.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/process_manager.h"
+#include "extensions/common/extension_messages.h"
namespace extensions {
ChromeNotificationObserver::ChromeNotificationObserver() {
- // Notifications for extensions::ProcessManager
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_BROWSER_WINDOW_READY,
content::NotificationService::AllSources());
+ registrar_.Add(this,
+ content::NOTIFICATION_RENDERER_PROCESS_CREATED,
+ content::NotificationService::AllBrowserContextsAndSources());
}
ChromeNotificationObserver::~ChromeNotificationObserver() {}
@@ -50,6 +57,13 @@ void ChromeNotificationObserver::OnBrowserWindowReady(Browser* browser) {
}
}
+void ChromeNotificationObserver::OnRendererProcessCreated(
+ content::RenderProcessHost* process) {
+ // Extensions need to know the channel for API restrictions. Send the channel
+ // to all renderers, as the non-extension renderers may have content scripts.
+ process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel()));
+}
+
void ChromeNotificationObserver::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -60,6 +74,13 @@ void ChromeNotificationObserver::Observe(int type,
break;
}
+ case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
+ content::RenderProcessHost* process =
+ content::Source<content::RenderProcessHost>(source).ptr();
+ OnRendererProcessCreated(process);
+ break;
+ }
+
default:
NOTREACHED();
}
diff --git a/chrome/browser/extensions/chrome_notification_observer.h b/chrome/browser/extensions/chrome_notification_observer.h
index 42d235a..a31dc87 100644
--- a/chrome/browser/extensions/chrome_notification_observer.h
+++ b/chrome/browser/extensions/chrome_notification_observer.h
@@ -12,6 +12,10 @@
class Browser;
+namespace content {
+class RenderProcessHost;
+}
+
namespace extensions {
// Observer for Chrome-specific notifications that need to be relayed to the
@@ -21,7 +25,9 @@ class ChromeNotificationObserver : public content::NotificationObserver {
ChromeNotificationObserver();
virtual ~ChromeNotificationObserver();
+ // IPC message handlers:
void OnBrowserWindowReady(Browser* browser);
+ void OnRendererProcessCreated(content::RenderProcessHost* process);
// content::NotificationObserver overrides:
virtual void Observe(int type,
diff --git a/extensions/DEPS b/extensions/DEPS
index 56345eb..dbfc9ba 100644
--- a/extensions/DEPS
+++ b/extensions/DEPS
@@ -12,7 +12,6 @@ include_rules = [
#
# TODO(jamescook): Remove these. http://crbug.com/162530
"!chrome/browser/chrome_notification_types.h",
- "!chrome/common/extensions/features/feature_channel.h",
"!grit/chromium_strings.h",
"!grit/common_resources.h",
"!grit/extensions_api_resources.h",
diff --git a/extensions/browser/renderer_startup_helper.cc b/extensions/browser/renderer_startup_helper.cc
index 6161024..9e1b604 100644
--- a/extensions/browser/renderer_startup_helper.cc
+++ b/extensions/browser/renderer_startup_helper.cc
@@ -5,7 +5,6 @@
#include "extensions/browser/renderer_startup_helper.h"
#include "base/values.h"
-#include "chrome/common/extensions/features/feature_channel.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -43,10 +42,6 @@ void RendererStartupHelper::Observe(
browser_context_, process->GetBrowserContext()))
break;
- // Extensions need to know the channel for API restrictions.
- process->Send(new ExtensionMsg_SetChannel(
- extensions::GetCurrentChannel()));
-
// Platform apps need to know the system font.
scoped_ptr<base::DictionaryValue> fonts(new base::DictionaryValue);
webui::SetFontAndTextDirection(fonts.get());
diff --git a/extensions/browser/renderer_startup_helper.h b/extensions/browser/renderer_startup_helper.h
index 2d7c271..a652209 100644
--- a/extensions/browser/renderer_startup_helper.h
+++ b/extensions/browser/renderer_startup_helper.h
@@ -19,7 +19,7 @@ class RenderProcessHost;
namespace extensions {
-// Informs renderers about extensions-related data (channel, available
+// Informs renderers about extensions-related data (loaded extensions, available
// functions, etc.) when they start. Sends this information to both extension
// and non-extension renderers, as the non-extension renderers may have content
// scripts. Lives on the UI thread. Shared between incognito and non-incognito