| 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 <set> |
| 9 #include <string> |
| 10 |
| 8 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" |
| 9 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h" | 12 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h" |
| 10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 11 #include "extensions/browser/extension_registry_observer.h" | 14 #include "extensions/browser/extension_registry_observer.h" |
| 12 | 15 |
| 13 class GURL; | 16 class GURL; |
| 14 class Profile; | 17 class Profile; |
| 15 | 18 |
| 16 namespace content { | 19 namespace content { |
| 17 class BrowserContext; | 20 class BrowserContext; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 | 37 |
| 35 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's | 38 // 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 | 39 // strong sandbox. Typically, these NaCl modules are stored in extensions |
| 37 // and registered here. Not all NaCl modules need to register for a MIME | 40 // 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 | 41 // 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 | 42 // type, like application/pdf. Note: We only register NaCl modules in the |
| 40 // browser process. | 43 // browser process. |
| 41 void RegisterNaClModule(const NaClModuleInfo& info); | 44 void RegisterNaClModule(const NaClModuleInfo& info); |
| 42 void UnregisterNaClModule(const NaClModuleInfo& info); | 45 void UnregisterNaClModule(const NaClModuleInfo& info); |
| 43 | 46 |
| 47 void RegisterMimeTypeHandler(const std::string& extension_id); |
| 48 void UnregisterMimeTypeHandler(const std::string& extension_id); |
| 49 |
| 44 // Call UpdatePluginListWithNaClModules() after registering or unregistering | 50 // Call UpdatePluginListWithNaClModules() after registering or unregistering |
| 45 // a NaCl module to see those changes reflected in the PluginList. | 51 // a NaCl module to see those changes reflected in the PluginList. |
| 46 void UpdatePluginListWithNaClModules(); | 52 void UpdatePluginListWithNaClModules(); |
| 47 | 53 |
| 48 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); | 54 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); |
| 49 | 55 |
| 50 // ExtensionRegistryObserver implementation. | 56 // ExtensionRegistryObserver implementation. |
| 51 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 57 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 52 const Extension* extension) OVERRIDE; | 58 const Extension* extension) OVERRIDE; |
| 53 virtual void OnExtensionUnloaded( | 59 virtual void OnExtensionUnloaded( |
| 54 content::BrowserContext* browser_context, | 60 content::BrowserContext* browser_context, |
| 55 const Extension* extension, | 61 const Extension* extension, |
| 56 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 62 UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 57 | 63 |
| 58 // BrowserContextKeyedAPI implementation. | 64 // BrowserContextKeyedAPI implementation. |
| 59 static const char* service_name() { return "PluginManager"; } | 65 static const char* service_name() { return "PluginManager"; } |
| 60 static const bool kServiceIsNULLWhileTesting = true; | 66 static const bool kServiceIsNULLWhileTesting = true; |
| 61 | 67 |
| 62 extensions::NaClModuleInfo::List nacl_module_list_; | 68 extensions::NaClModuleInfo::List nacl_module_list_; |
| 63 | 69 |
| 70 // The set of extensions that are registered as the handler for at least one |
| 71 // MIME type. |
| 72 std::set<std::string> mime_type_handler_extension_ids_; |
| 73 |
| 64 Profile* profile_; | 74 Profile* profile_; |
| 65 | 75 |
| 66 // Listen to extension load, unloaded notifications. | 76 // Listen to extension load, unloaded notifications. |
| 67 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 77 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 68 extension_registry_observer_; | 78 extension_registry_observer_; |
| 69 }; | 79 }; |
| 70 | 80 |
| 71 } // namespace extensions | 81 } // namespace extensions |
| 72 | 82 |
| 73 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ | 83 #endif // CHROME_BROWSER_EXTENSIONS_PLUGIN_MANAGER_H_ |
| OLD | NEW |