OLD | NEW |
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 EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 explicit DeclarativeUserScriptManager( | 26 explicit DeclarativeUserScriptManager( |
27 content::BrowserContext* browser_context); | 27 content::BrowserContext* browser_context); |
28 ~DeclarativeUserScriptManager() override; | 28 ~DeclarativeUserScriptManager() override; |
29 | 29 |
30 // Gets the user script master for declarative scripts by the given | 30 // Gets the user script master for declarative scripts by the given |
31 // 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. |
32 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( | 32 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( |
33 const HostID& host_id); | 33 const HostID& host_id); |
34 | 34 |
| 35 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByID( |
| 36 content::BrowserContext* browser_context, const HostID& host_id); |
| 37 |
35 private: | 38 private: |
36 using UserScriptMasterMap = | 39 using UserScriptMasterMap = |
37 std::map<HostID, linked_ptr<DeclarativeUserScriptMaster>>; | 40 std::map<HostID, linked_ptr<DeclarativeUserScriptMaster>>; |
38 | 41 |
39 // ExtensionRegistryObserver: | 42 // ExtensionRegistryObserver: |
40 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 43 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
41 const Extension* extension, | 44 const Extension* extension, |
42 UnloadedExtensionInfo::Reason reason) override; | 45 UnloadedExtensionInfo::Reason reason) override; |
43 | 46 |
44 // Creates a DeclarativeUserScriptMaster object. | 47 // Creates a DeclarativeUserScriptMaster object. |
45 DeclarativeUserScriptMaster* CreateDeclarativeUserScriptMaster( | 48 DeclarativeUserScriptMaster* CreateDeclarativeUserScriptMaster( |
46 const HostID& host_id); | 49 content::BrowserContext* browser_context, const HostID& host_id); |
47 | 50 |
48 // A map of DeclarativeUserScriptMasters for each host; each master | 51 // A map of DeclarativeUserScriptMasters for each host; each master |
49 // is lazily initialized. | 52 // is lazily initialized. |
50 UserScriptMasterMap declarative_user_script_masters_; | 53 UserScriptMasterMap declarative_user_script_masters_; |
51 | 54 |
52 content::BrowserContext* browser_context_; | 55 content::BrowserContext* browser_context_; |
53 | 56 |
54 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 57 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
55 extension_registry_observer_; | 58 extension_registry_observer_; |
56 | 59 |
57 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); | 60 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptManager); |
58 }; | 61 }; |
59 | 62 |
60 } // namespace extensions | 63 } // namespace extensions |
61 | 64 |
62 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ | 65 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MANAGER_H_ |
OLD | NEW |