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

Side by Side Diff: extensions/browser/declarative_user_script_manager.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 2014 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_DECLARATIVE_USER_SCRIPT_MANAGER_H_ 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_ 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "extensions/browser/extension_registry_observer.h" 13 #include "extensions/browser/extension_registry_observer.h"
14 #include "extensions/common/host_id.h" 14 #include "extensions/common/host_id.h"
15 15
16 class Profile; 16 namespace content {
17 class BrowserContext;
18 }
17 19
18 namespace extensions { 20 namespace extensions {
19 class DeclarativeUserScriptMaster; 21 class DeclarativeUserScriptMaster;
20 22
21 // Manages a set of DeclarativeUserScriptMaster objects for script injections. 23 // Manages a set of DeclarativeUserScriptMaster objects for script injections.
22 class DeclarativeUserScriptManager : public ExtensionRegistryObserver { 24 class DeclarativeUserScriptManager : public ExtensionRegistryObserver {
23 public: 25 public:
24 explicit DeclarativeUserScriptManager(Profile* profile); 26 explicit DeclarativeUserScriptManager(
27 content::BrowserContext* browser_context);
25 ~DeclarativeUserScriptManager() override; 28 ~DeclarativeUserScriptManager() override;
26 29
27 // Gets the user script master for declarative scripts by the given 30 // Gets the user script master for declarative scripts by the given
28 // HostID; if one does not exist, a new object will be created. 31 // HostID; if one does not exist, a new object will be created.
29 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( 32 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID(
30 const HostID& host_id); 33 const HostID& host_id);
31 34
32 private: 35 private:
33 using UserScriptMasterMap = 36 using UserScriptMasterMap =
34 std::map<HostID, linked_ptr<DeclarativeUserScriptMaster>>; 37 std::map<HostID, linked_ptr<DeclarativeUserScriptMaster>>;
35 38
36 // ExtensionRegistryObserver: 39 // ExtensionRegistryObserver:
37 void OnExtensionUnloaded(content::BrowserContext* browser_context, 40 void OnExtensionUnloaded(content::BrowserContext* browser_context,
38 const Extension* extension, 41 const Extension* extension,
39 UnloadedExtensionInfo::Reason reason) override; 42 UnloadedExtensionInfo::Reason reason) override;
40 43
41 // Creates a DeclarativeUserScriptMaster object. 44 // Creates a DeclarativeUserScriptMaster object.
42 DeclarativeUserScriptMaster* CreateDeclarativeUserScriptMaster( 45 DeclarativeUserScriptMaster* CreateDeclarativeUserScriptMaster(
43 const HostID& host_id); 46 const HostID& host_id);
44 47
45 // A map of DeclarativeUserScriptMasters for each host; each master 48 // A map of DeclarativeUserScriptMasters for each host; each master
46 // is lazily initialized. 49 // is lazily initialized.
47 UserScriptMasterMap declarative_user_script_masters_; 50 UserScriptMasterMap declarative_user_script_masters_;
48 51
49 Profile* profile_; 52 content::BrowserContext* browser_context_;
50 53
51 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 54 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
52 extension_registry_observer_; 55 extension_registry_observer_;
53 56
54 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); 57 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager);
55 }; 58 };
56 59
57 } // namespace extensions 60 } // namespace extensions
58 61
59 #endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MANAGER_H_ 62 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | extensions/browser/declarative_user_script_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698