1 // Copyright (c) 2012 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_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_
8 #include "base/basictypes.h"
9 #include "base/scoped_observer.h"
10 #include "extensions/browser/browser_context_keyed_api_factory.h"
11 #include "extensions/browser/extension_registry_observer.h"
17 namespace extensions
{
18 class ExtensionRegistry
;
20 class ExtensionWebUIOverrideRegistrar
: public BrowserContextKeyedAPI
,
21 public ExtensionRegistryObserver
{
23 explicit ExtensionWebUIOverrideRegistrar(content::BrowserContext
* context
);
24 virtual ~ExtensionWebUIOverrideRegistrar();
26 // BrowserContextKeyedAPI implementation.
27 static BrowserContextKeyedAPIFactory
<ExtensionWebUIOverrideRegistrar
>*
31 friend class BrowserContextKeyedAPIFactory
<ExtensionWebUIOverrideRegistrar
>;
33 // ExtensionRegistryObserver implementation.
34 virtual void OnExtensionLoaded(content::BrowserContext
* browser_context
,
35 const Extension
* extension
) OVERRIDE
;
36 virtual void OnExtensionUnloaded(
37 content::BrowserContext
* browser_context
,
38 const Extension
* extension
,
39 UnloadedExtensionInfo::Reason reason
) OVERRIDE
;
41 // BrowserContextKeyedAPI implementation.
42 static const char* service_name() {
43 return "ExtensionWebUIOverrideRegistrar";
46 // Listen to extension load, unloaded notifications.
47 ScopedObserver
<ExtensionRegistry
, ExtensionRegistryObserver
>
48 extension_registry_observer_
;
50 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIOverrideRegistrar
);
53 } // namespace extensions
55 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_