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_H_ | 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ | 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 namespace extensions { | 25 namespace extensions { |
26 class ScriptInjection; | 26 class ScriptInjection; |
27 | 27 |
28 // The UserScriptSet is a collection of UserScripts which knows how to update | 28 // The UserScriptSet is a collection of UserScripts which knows how to update |
29 // itself from SharedMemory and create ScriptInjections for UserScripts to | 29 // itself from SharedMemory and create ScriptInjections for UserScripts to |
30 // inject on a page. | 30 // inject on a page. |
31 class UserScriptSet { | 31 class UserScriptSet { |
32 public: | 32 public: |
33 class Observer { | 33 class Observer { |
34 public: | 34 public: |
| 35 // Called when the set of user scripts is updated. |changed_hosts| contains |
| 36 // the hosts whose scripts have been altered. Note that *all* script objects |
| 37 // are invalidated, even if they aren't in |changed_hosts|. |
35 virtual void OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, | 38 virtual void OnUserScriptsUpdated(const std::set<HostID>& changed_hosts, |
36 const UserScriptList& scripts) = 0; | 39 const UserScriptList& scripts) = 0; |
37 }; | 40 }; |
38 | 41 |
39 UserScriptSet(); | 42 UserScriptSet(); |
40 ~UserScriptSet(); | 43 ~UserScriptSet(); |
41 | 44 |
42 // Adds or removes observers. | 45 // Adds or removes observers. |
43 void AddObserver(Observer* observer); | 46 void AddObserver(Observer* observer); |
44 void RemoveObserver(Observer* observer); | 47 void RemoveObserver(Observer* observer); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 93 |
91 // The associated observers. | 94 // The associated observers. |
92 base::ObserverList<Observer> observers_; | 95 base::ObserverList<Observer> observers_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); | 97 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); |
95 }; | 98 }; |
96 | 99 |
97 } // namespace extensions | 100 } // namespace extensions |
98 | 101 |
99 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ | 102 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
OLD | NEW |