OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_API_SPELLCHECK_SPELLCHECK_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
7 | 7 |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "extensions/browser/browser_context_keyed_api_factory.h" | 9 #include "chrome/browser/extensions/declarative_user_script_master.h" |
| 10 #include "chrome/browser/extensions/extension_user_script_loader.h" |
10 #include "extensions/browser/extension_registry_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
| 12 #include "extensions/common/consumer.h" |
| 13 #include "extensions/common/extension.h" |
| 14 |
| 15 class Profile; |
11 | 16 |
12 namespace extensions { | 17 namespace extensions { |
| 18 |
13 class ExtensionRegistry; | 19 class ExtensionRegistry; |
| 20 class UserScript; |
14 | 21 |
15 class SpellcheckAPI : public BrowserContextKeyedAPI, | 22 // Extension implmentation of DeclarativeUserScriptMaster. |
16 public ExtensionRegistryObserver { | 23 class ExtensionDeclarativeUserScriptMaster : public DeclarativeUserScriptMaster, |
| 24 public ExtensionRegistryObserver { |
17 public: | 25 public: |
18 explicit SpellcheckAPI(content::BrowserContext* context); | 26 ExtensionDeclarativeUserScriptMaster(Profile* profile, const ConsumerID& id); |
19 ~SpellcheckAPI() override; | 27 ~ExtensionDeclarativeUserScriptMaster() override; |
20 | |
21 // BrowserContextKeyedAPI implementation. | |
22 static BrowserContextKeyedAPIFactory<SpellcheckAPI>* GetFactoryInstance(); | |
23 | 28 |
24 private: | 29 private: |
25 friend class BrowserContextKeyedAPIFactory<SpellcheckAPI>; | |
26 | |
27 // ExtensionRegistryObserver implementation. | 30 // ExtensionRegistryObserver implementation. |
28 void OnExtensionLoaded(content::BrowserContext* browser_context, | |
29 const Extension* extension) override; | |
30 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 31 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
31 const Extension* extension, | 32 const Extension* extension, |
32 UnloadedExtensionInfo::Reason reason) override; | 33 UnloadedExtensionInfo::Reason reason) override; |
33 | 34 |
34 // BrowserContextKeyedAPI implementation. | |
35 static const char* service_name() { | |
36 return "SpellcheckAPI"; | |
37 } | |
38 | |
39 // Listen to extension load, unloaded notifications. | |
40 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 35 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
41 extension_registry_observer_; | 36 extension_registry_observer_; |
42 | 37 |
43 DISALLOW_COPY_AND_ASSIGN(SpellcheckAPI); | 38 DISALLOW_COPY_AND_ASSIGN(ExtensionDeclarativeUserScriptMaster); |
44 }; | 39 }; |
45 | 40 |
46 template <> | |
47 void BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies(); | |
48 | |
49 } // namespace extensions | 41 } // namespace extensions |
50 | 42 |
51 #endif // CHROME_BROWSER_EXTENSIONS_API_SPELLCHECK_SPELLCHECK_API_H_ | 43 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
OLD | NEW |