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_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 content::RenderFrame* render_frame, | 74 content::RenderFrame* render_frame, |
75 int tab_id, | 75 int tab_id, |
76 UserScript::RunLocation run_location); | 76 UserScript::RunLocation run_location); |
77 | 77 |
78 // Get active extension IDs from |static_scripts| and each of | 78 // Get active extension IDs from |static_scripts| and each of |
79 // |programmatic_scripts_|. | 79 // |programmatic_scripts_|. |
80 void GetAllActiveExtensionIds(std::set<std::string>* ids) const; | 80 void GetAllActiveExtensionIds(std::set<std::string>* ids) const; |
81 | 81 |
82 const UserScriptSet* static_scripts() const { return &static_scripts_; } | 82 const UserScriptSet* static_scripts() const { return &static_scripts_; } |
83 | 83 |
| 84 void set_activity_logging_enabled(bool enabled) { |
| 85 activity_logging_enabled_ = enabled; |
| 86 } |
| 87 |
84 private: | 88 private: |
85 // Map for per-extension sets that may be defined programmatically. | 89 // Map for per-extension sets that may be defined programmatically. |
86 typedef std::map<HostID, linked_ptr<UserScriptSet> > UserScriptSetMap; | 90 typedef std::map<HostID, linked_ptr<UserScriptSet> > UserScriptSetMap; |
87 | 91 |
88 // content::RenderThreadObserver implementation. | 92 // content::RenderThreadObserver implementation. |
89 bool OnControlMessageReceived(const IPC::Message& message) override; | 93 bool OnControlMessageReceived(const IPC::Message& message) override; |
90 | 94 |
91 UserScriptSet* GetProgrammaticScriptsByHostID(const HostID& host_id); | 95 UserScriptSet* GetProgrammaticScriptsByHostID(const HostID& host_id); |
92 | 96 |
93 // Handle the UpdateUserScripts extension message. | 97 // Handle the UpdateUserScripts extension message. |
94 void OnUpdateUserScripts(base::SharedMemoryHandle shared_memory, | 98 void OnUpdateUserScripts(base::SharedMemoryHandle shared_memory, |
95 const HostID& host_id, | 99 const HostID& host_id, |
96 const std::set<HostID>& changed_hosts, | 100 const std::set<HostID>& changed_hosts, |
97 bool whitelisted_only); | 101 bool whitelisted_only); |
98 | 102 |
99 // Scripts statically defined in extension manifests. | 103 // Scripts statically defined in extension manifests. |
100 UserScriptSet static_scripts_; | 104 UserScriptSet static_scripts_; |
101 | 105 |
102 // Scripts programmatically-defined through API calls (initialized and stored | 106 // Scripts programmatically-defined through API calls (initialized and stored |
103 // per-extension). | 107 // per-extension). |
104 UserScriptSetMap programmatic_scripts_; | 108 UserScriptSetMap programmatic_scripts_; |
105 | 109 |
| 110 // Whether or not dom activity should be logged for injected scripts. |
| 111 bool activity_logging_enabled_; |
| 112 |
106 // The associated observers. | 113 // The associated observers. |
107 base::ObserverList<Observer> observers_; | 114 base::ObserverList<Observer> observers_; |
108 | 115 |
109 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); | 116 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); |
110 }; | 117 }; |
111 | 118 |
112 } // namespace extensions | 119 } // namespace extensions |
113 | 120 |
114 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 121 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
OLD | NEW |