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. 4 5 #ifndef CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ 7 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" 12 13 class GURL; 14 class Profile; 15 16 namespace extensions { 17 18 class PluginManager : public ProfileKeyedAPI, 19 public content::NotificationObserver { 20 public: 21 explicit PluginManager(Profile* profile); 22 virtual ~PluginManager(); 23 24 // ProfileKeyedAPI implementation. 25 static ProfileKeyedAPIFactory<PluginManager>* GetFactoryInstance(); 26 27 // content::NotificationObserver impelmentation. 28 virtual void Observe(int type, 29 const content::NotificationSource& source, 30 const content::NotificationDetails& details) OVERRIDE; 31 32 private: 33 friend class ProfileKeyedAPIFactory<PluginManager>; 34 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 40 // browser process. 41 void RegisterNaClModule(const NaClModuleInfo& info); 42 void UnregisterNaClModule(const NaClModuleInfo& info); 43 44 // Call UpdatePluginListWithNaClModules() after registering or unregistering 45 // a NaCl module to see those changes reflected in the PluginList. 46 void UpdatePluginListWithNaClModules(); 47 48 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); 49 50 // ProfileKeyedAPI implementation. 51 static const char* service_name() { return "PluginManager"; } 52 static const bool kServiceIsNULLWhileTesting = true; 53 54 extensions::NaClModuleInfo::List nacl_module_list_; 55 56 content::NotificationRegistrar registrar_; 57 58 Profile* profile_; 59 }; 60 61 } // namespace extensions 62 63 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ 64