1 // Copyright (c) 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_API_SPELLCHECK_SPELLCHECK_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_
8 #include "base/scoped_observer.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
10 #include "extensions/browser/extension_registry_observer.h"
12 namespace extensions
{
13 class ExtensionRegistry
;
15 class SpellcheckAPI
: public BrowserContextKeyedAPI
,
16 public ExtensionRegistryObserver
{
18 explicit SpellcheckAPI(content::BrowserContext
* context
);
19 ~SpellcheckAPI() override
;
21 // BrowserContextKeyedAPI implementation.
22 static BrowserContextKeyedAPIFactory
<SpellcheckAPI
>* GetFactoryInstance();
25 friend class BrowserContextKeyedAPIFactory
<SpellcheckAPI
>;
27 // ExtensionRegistryObserver implementation.
28 void OnExtensionLoaded(content::BrowserContext
* browser_context
,
29 const Extension
* extension
) override
;
30 void OnExtensionUnloaded(content::BrowserContext
* browser_context
,
31 const Extension
* extension
,
32 UnloadedExtensionInfo::Reason reason
) override
;
34 // BrowserContextKeyedAPI implementation.
35 static const char* service_name() {
36 return "SpellcheckAPI";
39 // Listen to extension load, unloaded notifications.
40 ScopedObserver
<ExtensionRegistry
, ExtensionRegistryObserver
>
41 extension_registry_observer_
;
43 DISALLOW_COPY_AND_ASSIGN(SpellcheckAPI
);
47 void BrowserContextKeyedAPIFactory
<SpellcheckAPI
>::DeclareFactoryDependencies();
49 } // namespace extensions
51 #endif // CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_