Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_notification_observer.cc
blobc8e6016350809013f0f49a33923be8baf46fd21d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/chrome_notification_observer.h"
7 #include "chrome/common/extensions/features/feature_channel.h"
8 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/notification_types.h"
10 #include "content/public/browser/render_process_host.h"
11 #include "extensions/common/extension_messages.h"
13 namespace extensions {
15 ChromeNotificationObserver::ChromeNotificationObserver() {
16 registrar_.Add(this,
17 content::NOTIFICATION_RENDERER_PROCESS_CREATED,
18 content::NotificationService::AllBrowserContextsAndSources());
21 ChromeNotificationObserver::~ChromeNotificationObserver() {}
23 void ChromeNotificationObserver::OnRendererProcessCreated(
24 content::RenderProcessHost* process) {
25 // Extensions need to know the channel for API restrictions. Send the channel
26 // to all renderers, as the non-extension renderers may have content scripts.
27 process->Send(new ExtensionMsg_SetChannel(GetCurrentChannel()));
30 void ChromeNotificationObserver::Observe(int type,
31 const content::NotificationSource& source,
32 const content::NotificationDetails& details) {
33 switch (type) {
34 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
35 content::RenderProcessHost* process =
36 content::Source<content::RenderProcessHost>(source).ptr();
37 OnRendererProcessCreated(process);
38 break;
41 default:
42 NOTREACHED();
46 } // namespace extensions