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 #ifndef CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_
8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
9 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
16 namespace extensions
{
18 class PluginManager
: public ProfileKeyedAPI
,
19 public content::NotificationObserver
{
21 explicit PluginManager(Profile
* profile
);
22 virtual ~PluginManager();
24 // ProfileKeyedAPI implementation.
25 static ProfileKeyedAPIFactory
<PluginManager
>* GetFactoryInstance();
27 // content::NotificationObserver impelmentation.
28 virtual void Observe(int type
,
29 const content::NotificationSource
& source
,
30 const content::NotificationDetails
& details
) OVERRIDE
;
33 friend class ProfileKeyedAPIFactory
<PluginManager
>;
35 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's
36 // strong sandbox. Typically, these NaCl modules are stored in extensions
37 // and registered here. Not all NaCl modules need to register for a MIME
38 // type, just the ones that are responsible for rendering a particular MIME
39 // type, like application/pdf. Note: We only register NaCl modules in the
41 void RegisterNaClModule(const NaClModuleInfo
& info
);
42 void UnregisterNaClModule(const NaClModuleInfo
& info
);
44 // Call UpdatePluginListWithNaClModules() after registering or unregistering
45 // a NaCl module to see those changes reflected in the PluginList.
46 void UpdatePluginListWithNaClModules();
48 extensions::NaClModuleInfo::List::iterator
FindNaClModule(const GURL
& url
);
50 // ProfileKeyedAPI implementation.
51 static const char* service_name() { return "PluginManager"; }
52 static const bool kServiceIsNULLWhileTesting
= true;
54 extensions::NaClModuleInfo::List nacl_module_list_
;
56 content::NotificationRegistrar registrar_
;
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_