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.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_
6#define CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_
7
8#include "base/scoped_observer.h"
9#include "extensions/browser/browser_context_keyed_api_factory.h"
10#include "extensions/browser/extension_registry_observer.h"
11
12namespace extensions {
13class ExtensionRegistry;
14
15class SpellcheckAPI : public BrowserContextKeyedAPI,
16                      public ExtensionRegistryObserver {
17 public:
18  explicit SpellcheckAPI(content::BrowserContext* context);
19  virtual ~SpellcheckAPI();
20
21  // BrowserContextKeyedAPI implementation.
22  static BrowserContextKeyedAPIFactory<SpellcheckAPI>* GetFactoryInstance();
23
24 private:
25  friend class BrowserContextKeyedAPIFactory<SpellcheckAPI>;
26
27  // ExtensionRegistryObserver implementation.
28  virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
29                                 const Extension* extension) OVERRIDE;
30  virtual void OnExtensionUnloaded(
31      content::BrowserContext* browser_context,
32      const Extension* extension,
33      UnloadedExtensionInfo::Reason reason) OVERRIDE;
34
35  // BrowserContextKeyedAPI implementation.
36  static const char* service_name() {
37    return "SpellcheckAPI";
38  }
39
40  // Listen to extension load, unloaded notifications.
41  ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
42      extension_registry_observer_;
43
44  DISALLOW_COPY_AND_ASSIGN(SpellcheckAPI);
45};
46
47template <>
48void BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies();
49
50}  // namespace extensions
51
52#endif  // CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_
53