OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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_EXTENSION_USER_SCRIPT_LOADER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ | |
7 | |
8 #include "base/memory/shared_memory.h" | |
9 #include "chrome/browser/extensions/user_script_loader.h" | |
10 #include "extensions/browser/extension_registry_observer.h" | |
11 #include "extensions/common/extension.h" | |
12 | |
13 namespace content { | |
14 class BrowserContext; | |
15 } | |
16 | |
17 class Profile; | |
18 | |
19 namespace extensions { | |
20 | |
21 class ExtensionRegistry; | |
22 | |
23 // UserScriptLoader for extensions. | |
24 class ExtensionUserScriptLoader : public UserScriptLoader, | |
25 public ExtensionRegistryObserver { | |
26 public: | |
27 // The listen_for_extension_system_loaded is only set true when initilizing | |
28 // the Exttension System, e.g, when constructs SharedUserScriptMaster in | |
Devlin
2015/01/27 22:06:39
typo: Exxtension
| |
29 // ExtensionSystemImpl. | |
30 ExtensionUserScriptLoader(Profile* profile, | |
31 const HostID& host_id, | |
32 bool listen_for_extension_system_loaded); | |
33 ~ExtensionUserScriptLoader() override; | |
34 | |
35 private: | |
36 // UserScriptLoader: | |
37 void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override; | |
38 LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override; | |
39 | |
40 // ExtensionRegistryObserver: | |
41 void OnExtensionUnloaded(content::BrowserContext* browser_context, | |
42 const Extension* extension, | |
43 UnloadedExtensionInfo::Reason reason) override; | |
44 | |
45 // Initiates script load when we have been waiting for the extension system | |
46 // to be ready. | |
47 void OnExtensionSystemReady(); | |
48 | |
49 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | |
50 extension_registry_observer_; | |
51 | |
52 base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader); | |
55 }; | |
56 | |
57 } // namespace extensions | |
58 | |
59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ | |
OLD | NEW |