| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
| 9 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h" | 8 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h" |
| 10 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
| 11 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 class PluginManager : public ProfileKeyedAPI, | 22 class PluginManager : public BrowserContextKeyedAPI, |
| 23 public content::NotificationObserver { | 23 public content::NotificationObserver { |
| 24 public: | 24 public: |
| 25 explicit PluginManager(content::BrowserContext* context); | 25 explicit PluginManager(content::BrowserContext* context); |
| 26 virtual ~PluginManager(); | 26 virtual ~PluginManager(); |
| 27 | 27 |
| 28 // ProfileKeyedAPI implementation. | 28 // BrowserContextKeyedAPI implementation. |
| 29 static ProfileKeyedAPIFactory<PluginManager>* GetFactoryInstance(); | 29 static BrowserContextKeyedAPIFactory<PluginManager>* GetFactoryInstance(); |
| 30 | 30 |
| 31 // content::NotificationObserver impelmentation. | 31 // content::NotificationObserver impelmentation. |
| 32 virtual void Observe(int type, | 32 virtual void Observe(int type, |
| 33 const content::NotificationSource& source, | 33 const content::NotificationSource& source, |
| 34 const content::NotificationDetails& details) OVERRIDE; | 34 const content::NotificationDetails& details) OVERRIDE; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 friend class ProfileKeyedAPIFactory<PluginManager>; | 37 friend class BrowserContextKeyedAPIFactory<PluginManager>; |
| 38 | 38 |
| 39 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's | 39 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's |
| 40 // strong sandbox. Typically, these NaCl modules are stored in extensions | 40 // strong sandbox. Typically, these NaCl modules are stored in extensions |
| 41 // and registered here. Not all NaCl modules need to register for a MIME | 41 // and registered here. Not all NaCl modules need to register for a MIME |
| 42 // type, just the ones that are responsible for rendering a particular MIME | 42 // type, just the ones that are responsible for rendering a particular MIME |
| 43 // type, like application/pdf. Note: We only register NaCl modules in the | 43 // type, like application/pdf. Note: We only register NaCl modules in the |
| 44 // browser process. | 44 // browser process. |
| 45 void RegisterNaClModule(const NaClModuleInfo& info); | 45 void RegisterNaClModule(const NaClModuleInfo& info); |
| 46 void UnregisterNaClModule(const NaClModuleInfo& info); | 46 void UnregisterNaClModule(const NaClModuleInfo& info); |
| 47 | 47 |
| 48 // Call UpdatePluginListWithNaClModules() after registering or unregistering | 48 // Call UpdatePluginListWithNaClModules() after registering or unregistering |
| 49 // a NaCl module to see those changes reflected in the PluginList. | 49 // a NaCl module to see those changes reflected in the PluginList. |
| 50 void UpdatePluginListWithNaClModules(); | 50 void UpdatePluginListWithNaClModules(); |
| 51 | 51 |
| 52 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); | 52 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); |
| 53 | 53 |
| 54 // ProfileKeyedAPI implementation. | 54 // BrowserContextKeyedAPI implementation. |
| 55 static const char* service_name() { return "PluginManager"; } | 55 static const char* service_name() { return "PluginManager"; } |
| 56 static const bool kServiceIsNULLWhileTesting = true; | 56 static const bool kServiceIsNULLWhileTesting = true; |
| 57 | 57 |
| 58 extensions::NaClModuleInfo::List nacl_module_list_; | 58 extensions::NaClModuleInfo::List nacl_module_list_; |
| 59 | 59 |
| 60 content::NotificationRegistrar registrar_; | 60 content::NotificationRegistrar registrar_; |
| 61 | 61 |
| 62 Profile* profile_; | 62 Profile* profile_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace extensions | 65 } // namespace extensions |
| 66 | 66 |
| 67 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ | 67 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ |
| OLD | NEW |