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

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

Powered by Google App Engine
This is Rietveld 408576698