summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 19:46:13 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 19:46:13 +0000
commit1dae773eba0c4b36957e5d226c211579ca0113c3 (patch)
tree9eaeb6168e95c0dfdd7fdc327174ae9460be6b84
parent9d800e61b54ffcaa59cd41390dc8491b6b7f9699 (diff)
downloadchromium_src-1dae773eba0c4b36957e5d226c211579ca0113c3.zip
chromium_src-1dae773eba0c4b36957e5d226c211579ca0113c3.tar.gz
chromium_src-1dae773eba0c4b36957e5d226c211579ca0113c3.tar.bz2
Toro: Remove chrome feature channel dep from //extensions
The existence of stable/beta/dev channel is a Chrome concept. Eliminate the reference to feature_channel.h in //extensions by observing for renderer startup and sending the channel to the renderer in //chrome. This is also one of our last //extensions -> //chrome circular dependencies. BUG=362244 TEST=browser_tests *Extensions* Review URL: https://codereview.chromium.org/234183002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263314 0039d316-1c4b-4281-b951-d872f2087c98
-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