blob: c61dd950ca1beb8af483cf33a614be10708d151b [file] [log] [blame]
[email protected]31622542013-05-30 19:42:301// 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.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_
6#define CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_
7
[email protected]6edb64882014-06-12 22:57:548#include <set>
9#include <string>
10
[email protected]96ac5962014-04-22 19:49:5811#include "base/scoped_observer.h"
[email protected]4bf3bed2014-03-05 10:21:0212#include "extensions/browser/browser_context_keyed_api_factory.h"
[email protected]96ac5962014-04-22 19:49:5813#include "extensions/browser/extension_registry_observer.h"
[email protected]b90f3432014-08-07 20:40:0714#include "extensions/common/manifest_handlers/nacl_modules_handler.h"
[email protected]31622542013-05-30 19:42:3015
16class GURL;
17class Profile;
18
[email protected]c4b717a772014-02-25 19:24:4119namespace content {
20class BrowserContext;
21}
22
[email protected]31622542013-05-30 19:42:3023namespace extensions {
[email protected]96ac5962014-04-22 19:49:5824class ExtensionRegistry;
[email protected]31622542013-05-30 19:42:3025
[email protected]4bf3bed2014-03-05 10:21:0226class PluginManager : public BrowserContextKeyedAPI,
[email protected]96ac5962014-04-22 19:49:5827 public ExtensionRegistryObserver {
[email protected]31622542013-05-30 19:42:3028 public:
[email protected]c4b717a772014-02-25 19:24:4129 explicit PluginManager(content::BrowserContext* context);
[email protected]31622542013-05-30 19:42:3030 virtual ~PluginManager();
31
[email protected]4bf3bed2014-03-05 10:21:0232 // BrowserContextKeyedAPI implementation.
33 static BrowserContextKeyedAPIFactory<PluginManager>* GetFactoryInstance();
[email protected]31622542013-05-30 19:42:3034
[email protected]31622542013-05-30 19:42:3035 private:
[email protected]4bf3bed2014-03-05 10:21:0236 friend class BrowserContextKeyedAPIFactory<PluginManager>;
[email protected]31622542013-05-30 19:42:3037
[email protected]7b474312014-07-17 08:35:4338#if !defined(DISABLE_NACL)
39
[email protected]31622542013-05-30 19:42:3040 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's
41 // strong sandbox. Typically, these NaCl modules are stored in extensions
42 // and registered here. Not all NaCl modules need to register for a MIME
43 // type, just the ones that are responsible for rendering a particular MIME
44 // type, like application/pdf. Note: We only register NaCl modules in the
45 // browser process.
46 void RegisterNaClModule(const NaClModuleInfo& info);
47 void UnregisterNaClModule(const NaClModuleInfo& info);
48
[email protected]31622542013-05-30 19:42:3049 // Call UpdatePluginListWithNaClModules() after registering or unregistering
50 // a NaCl module to see those changes reflected in the PluginList.
51 void UpdatePluginListWithNaClModules();
52
53 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url);
54
[email protected]7b474312014-07-17 08:35:4355#endif // !defined(DISABLE_NACL)
56
[email protected]96ac5962014-04-22 19:49:5857 // ExtensionRegistryObserver implementation.
58 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
59 const Extension* extension) OVERRIDE;
60 virtual void OnExtensionUnloaded(
61 content::BrowserContext* browser_context,
62 const Extension* extension,
63 UnloadedExtensionInfo::Reason reason) OVERRIDE;
64
[email protected]4bf3bed2014-03-05 10:21:0265 // BrowserContextKeyedAPI implementation.
[email protected]31622542013-05-30 19:42:3066 static const char* service_name() { return "PluginManager"; }
67 static const bool kServiceIsNULLWhileTesting = true;
68
69 extensions::NaClModuleInfo::List nacl_module_list_;
70
[email protected]31622542013-05-30 19:42:3071 Profile* profile_;
[email protected]96ac5962014-04-22 19:49:5872
73 // Listen to extension load, unloaded notifications.
74 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
75 extension_registry_observer_;
[email protected]31622542013-05-30 19:42:3076};
77
78} // namespace extensions
79
80#endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_