Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: extensions/browser/extension_user_script_loader.h

Issue 955473002: Move DeclarativeUserScriptManager/Master and UserScriptLoader to //extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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_EXTENSION_USER_SCRIPT_LOADER_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_
7 7
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "chrome/browser/extensions/user_script_loader.h"
10 #include "extensions/browser/extension_registry_observer.h" 9 #include "extensions/browser/extension_registry_observer.h"
10 #include "extensions/browser/user_script_loader.h"
11 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
12 12
13 namespace content { 13 namespace content {
14 class BrowserContext; 14 class BrowserContext;
15 } 15 }
16 16
17 class Profile;
18
19 namespace extensions { 17 namespace extensions {
20 18
21 class ExtensionRegistry; 19 class ExtensionRegistry;
22 20
23 // UserScriptLoader for extensions. 21 // UserScriptLoader for extensions.
24 class ExtensionUserScriptLoader : public UserScriptLoader, 22 class ExtensionUserScriptLoader : public UserScriptLoader,
25 public ExtensionRegistryObserver { 23 public ExtensionRegistryObserver {
26 public: 24 public:
27 // The listen_for_extension_system_loaded is only set true when initilizing 25 // The listen_for_extension_system_loaded is only set true when initilizing
28 // the Extension System, e.g, when constructs SharedUserScriptMaster in 26 // the Extension System, e.g, when constructs SharedUserScriptMaster in
29 // ExtensionSystemImpl. 27 // ExtensionSystemImpl.
30 ExtensionUserScriptLoader(Profile* profile, 28 ExtensionUserScriptLoader(content::BrowserContext* browser_context,
31 const HostID& host_id, 29 const HostID& host_id,
32 bool listen_for_extension_system_loaded); 30 bool listen_for_extension_system_loaded);
33 ~ExtensionUserScriptLoader() override; 31 ~ExtensionUserScriptLoader() override;
34 32
35 private: 33 private:
36 // UserScriptLoader: 34 // UserScriptLoader:
37 void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override; 35 void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override;
38 LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override; 36 LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override;
39 37
40 // ExtensionRegistryObserver: 38 // ExtensionRegistryObserver:
41 void OnExtensionUnloaded(content::BrowserContext* browser_context, 39 void OnExtensionUnloaded(content::BrowserContext* browser_context,
42 const Extension* extension, 40 const Extension* extension,
43 UnloadedExtensionInfo::Reason reason) override; 41 UnloadedExtensionInfo::Reason reason) override;
44 42
45 // Initiates script load when we have been waiting for the extension system 43 // Initiates script load when we have been waiting for the extension system
46 // to be ready. 44 // to be ready.
47 void OnExtensionSystemReady(); 45 void OnExtensionSystemReady();
48 46
49 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 47 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
50 extension_registry_observer_; 48 extension_registry_observer_;
51 49
52 base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_; 50 base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_;
53 51
54 DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader); 52 DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader);
55 }; 53 };
56 54
57 } // namespace extensions 55 } // namespace extensions
58 56
59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ 57 #endif // EXTENSIONS_BROWSER_EXTENSION_USER_SCRIPT_LOADER_H_
OLDNEW
« no previous file with comments | « extensions/browser/declarative_user_script_master.cc ('k') | extensions/browser/extension_user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698