blob: 3a3e213e2960ba84d63aaba6f28eb0dfdaaba10c [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
Evan Stade75872a62019-09-06 21:17:3811#include "base/macros.h"
[email protected]96ac5962014-04-22 19:49:5812#include "base/scoped_observer.h"
Scott Violet9ae82892018-03-01 18:38:1213#include "components/nacl/common/buildflags.h"
[email protected]4bf3bed2014-03-05 10:21:0214#include "extensions/browser/browser_context_keyed_api_factory.h"
Evan Stade75872a62019-09-06 21:17:3815#include "extensions/browser/extension_registry.h"
[email protected]96ac5962014-04-22 19:49:5816#include "extensions/browser/extension_registry_observer.h"
[email protected]b90f3432014-08-07 20:40:0717#include "extensions/common/manifest_handlers/nacl_modules_handler.h"
[email protected]31622542013-05-30 19:42:3018
19class GURL;
20class Profile;
21
[email protected]c4b717a772014-02-25 19:24:4122namespace content {
23class BrowserContext;
24}
25
[email protected]31622542013-05-30 19:42:3026namespace extensions {
[email protected]31622542013-05-30 19:42:3027
[email protected]4bf3bed2014-03-05 10:21:0228class PluginManager : public BrowserContextKeyedAPI,
[email protected]96ac5962014-04-22 19:49:5829 public ExtensionRegistryObserver {
[email protected]31622542013-05-30 19:42:3030 public:
[email protected]c4b717a772014-02-25 19:24:4131 explicit PluginManager(content::BrowserContext* context);
dchengae36a4a2014-10-21 12:36:3632 ~PluginManager() override;
[email protected]31622542013-05-30 19:42:3033
[email protected]4bf3bed2014-03-05 10:21:0234 // BrowserContextKeyedAPI implementation.
35 static BrowserContextKeyedAPIFactory<PluginManager>* GetFactoryInstance();
[email protected]31622542013-05-30 19:42:3036
[email protected]31622542013-05-30 19:42:3037 private:
[email protected]4bf3bed2014-03-05 10:21:0238 friend class BrowserContextKeyedAPIFactory<PluginManager>;
[email protected]31622542013-05-30 19:42:3039
Nico Weberaf3b00b2017-09-11 17:58:1740#if BUILDFLAG(ENABLE_NACL)
[email protected]7b474312014-07-17 08:35:4341
tommyclie86b2982015-03-16 20:16:4542 // We implement some Pepper plugins using NaCl to take advantage of NaCl's
[email protected]31622542013-05-30 19:42:3043 // strong sandbox. Typically, these NaCl modules are stored in extensions
44 // and registered here. Not all NaCl modules need to register for a MIME
45 // type, just the ones that are responsible for rendering a particular MIME
46 // type, like application/pdf. Note: We only register NaCl modules in the
47 // browser process.
48 void RegisterNaClModule(const NaClModuleInfo& info);
49 void UnregisterNaClModule(const NaClModuleInfo& info);
50
51 // Call UpdatePluginListWithNaClModules() after registering or unregistering
52 // a NaCl module to see those changes reflected in the PluginList.
53 void UpdatePluginListWithNaClModules();
54
55 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url);
56
Nico Weberaf3b00b2017-09-11 17:58:1757#endif // BUILDFLAG(ENABLE_NACL)
[email protected]7b474312014-07-17 08:35:4358
[email protected]96ac5962014-04-22 19:49:5859 // ExtensionRegistryObserver implementation.
dchengae36a4a2014-10-21 12:36:3660 void OnExtensionLoaded(content::BrowserContext* browser_context,
61 const Extension* extension) override;
62 void OnExtensionUnloaded(content::BrowserContext* browser_context,
63 const Extension* extension,
limasdf0deef2042017-05-03 19:17:1764 UnloadedExtensionReason reason) override;
[email protected]96ac5962014-04-22 19:49:5865
[email protected]4bf3bed2014-03-05 10:21:0266 // BrowserContextKeyedAPI implementation.
[email protected]31622542013-05-30 19:42:3067 static const char* service_name() { return "PluginManager"; }
68 static const bool kServiceIsNULLWhileTesting = true;
69
70 extensions::NaClModuleInfo::List nacl_module_list_;
71
[email protected]31622542013-05-30 19:42:3072 Profile* profile_;
[email protected]96ac5962014-04-22 19:49:5873
74 // Listen to extension load, unloaded notifications.
75 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
Evan Stade75872a62019-09-06 21:17:3876 extension_registry_observer_{this};
77
78 DISALLOW_COPY_AND_ASSIGN(PluginManager);
[email protected]31622542013-05-30 19:42:3079};
80
81} // namespace extensions
82
83#endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_