Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / extensions / browser / extension_user_script_loader.h
blob5ca40605a74a645bd69ef5e2fe8a3dada68be065
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.
5 #ifndef EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_
8 #include "base/memory/shared_memory.h"
9 #include "extensions/browser/extension_registry_observer.h"
10 #include "extensions/browser/user_script_loader.h"
11 #include "extensions/common/extension.h"
13 namespace content {
14 class BrowserContext;
17 namespace extensions {
19 class ExtensionRegistry;
21 // UserScriptLoader for extensions.
22 class ExtensionUserScriptLoader : public UserScriptLoader,
23 public ExtensionRegistryObserver {
24 public:
25 // The listen_for_extension_system_loaded is only set true when initilizing
26 // the Extension System, e.g, when constructs SharedUserScriptMaster in
27 // ExtensionSystemImpl.
28 ExtensionUserScriptLoader(content::BrowserContext* browser_context,
29 const HostID& host_id,
30 bool listen_for_extension_system_loaded);
31 ~ExtensionUserScriptLoader() override;
33 private:
34 // UserScriptLoader:
35 void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override;
36 LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override;
38 // ExtensionRegistryObserver:
39 void OnExtensionUnloaded(content::BrowserContext* browser_context,
40 const Extension* extension,
41 UnloadedExtensionInfo::Reason reason) override;
43 // Initiates script load when we have been waiting for the extension system
44 // to be ready.
45 void OnExtensionSystemReady();
47 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
48 extension_registry_observer_;
50 base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_;
52 DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader);
55 } // namespace extensions
57 #endif // EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_