| 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 28 matching lines...) Expand all Loading... |
| 39 // only programmatically-declared scripts, instantiated | 39 // only programmatically-declared scripts, instantiated |
| 40 // when an extension first creates a declarative rule | 40 // when an extension first creates a declarative rule |
| 41 // that would, if triggered, request a script injection. | 41 // that would, if triggered, request a script injection. |
| 42 class UserScriptSetManager : public content::RenderThreadObserver { | 42 class UserScriptSetManager : public content::RenderThreadObserver { |
| 43 public: | 43 public: |
| 44 // Like a UserScriptSet::Observer, but automatically subscribes to all sets | 44 // Like a UserScriptSet::Observer, but automatically subscribes to all sets |
| 45 // associated with the manager. | 45 // associated with the manager. |
| 46 class Observer { | 46 class Observer { |
| 47 public: | 47 public: |
| 48 virtual void OnUserScriptsUpdated( | 48 virtual void OnUserScriptsUpdated( |
| 49 const std::set<HostID>& changed_hosts, | 49 const std::set<HostID>& changed_hosts) = 0; |
| 50 const std::vector<UserScript*>& scripts) = 0; | |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 UserScriptSetManager(); | 52 UserScriptSetManager(); |
| 54 | 53 |
| 55 ~UserScriptSetManager() override; | 54 ~UserScriptSetManager() override; |
| 56 | 55 |
| 57 void AddObserver(Observer* observer); | 56 void AddObserver(Observer* observer); |
| 58 void RemoveObserver(Observer* observer); | 57 void RemoveObserver(Observer* observer); |
| 59 | 58 |
| 60 // Looks up the script injection associated with |script_id| and | 59 // Looks up the script injection associated with |script_id| and |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 111 |
| 113 // The associated observers. | 112 // The associated observers. |
| 114 base::ObserverList<Observer> observers_; | 113 base::ObserverList<Observer> observers_; |
| 115 | 114 |
| 116 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); | 115 DISALLOW_COPY_AND_ASSIGN(UserScriptSetManager); |
| 117 }; | 116 }; |
| 118 | 117 |
| 119 } // namespace extensions | 118 } // namespace extensions |
| 120 | 119 |
| 121 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ | 120 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_MANAGER_H_ |
| OLD | NEW |