| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const content::NotificationDetails& details) OVERRIDE; | 142 const content::NotificationDetails& details) OVERRIDE; |
| 143 | 143 |
| 144 // ExtensionRegistryObserver implementation. | 144 // ExtensionRegistryObserver implementation. |
| 145 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 145 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 146 const Extension* extension) OVERRIDE; | 146 const Extension* extension) OVERRIDE; |
| 147 virtual void OnExtensionUnloaded( | 147 virtual void OnExtensionUnloaded( |
| 148 content::BrowserContext* browser_context, | 148 content::BrowserContext* browser_context, |
| 149 const Extension* extension, | 149 const Extension* extension, |
| 150 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 150 UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 151 | 151 |
| 152 // Sends the renderer process a new set of user scripts. | 152 // Sends the renderer process a new set of user scripts. If |
| 153 // |changed_extensions| is not empty, this signals that only the scripts from |
| 154 // those extensions should be updated. Otherwise, all extensions will be |
| 155 // updated. |
| 153 void SendUpdate(content::RenderProcessHost* process, | 156 void SendUpdate(content::RenderProcessHost* process, |
| 154 base::SharedMemory* shared_memory); | 157 base::SharedMemory* shared_memory, |
| 158 const std::set<std::string>& changed_extensions); |
| 155 | 159 |
| 156 // Manages our notification registrations. | 160 // Manages our notification registrations. |
| 157 content::NotificationRegistrar registrar_; | 161 content::NotificationRegistrar registrar_; |
| 158 | 162 |
| 159 // We hang on to our pointer to know if we've already got one running. | 163 // We hang on to our pointer to know if we've already got one running. |
| 160 scoped_refptr<ScriptReloader> script_reloader_; | 164 scoped_refptr<ScriptReloader> script_reloader_; |
| 161 | 165 |
| 162 // Contains the scripts that were found the last time scripts were updated. | 166 // Contains the scripts that were found the last time scripts were updated. |
| 163 scoped_ptr<base::SharedMemory> shared_memory_; | 167 scoped_ptr<base::SharedMemory> shared_memory_; |
| 164 | 168 |
| 165 // List of scripts from currently-installed extensions we should load. | 169 // List of scripts from currently-installed extensions we should load. |
| 166 UserScriptList user_scripts_; | 170 UserScriptList user_scripts_; |
| 167 | 171 |
| 168 // Maps extension info needed for localization to an extension ID. | 172 // Maps extension info needed for localization to an extension ID. |
| 169 ExtensionsInfo extensions_info_; | 173 ExtensionsInfo extensions_info_; |
| 170 | 174 |
| 175 // The IDs of the extensions which have changed since the last update sent to |
| 176 // the renderer. |
| 177 std::set<std::string> changed_extensions_; |
| 178 |
| 171 // If the extensions service has finished loading its initial set of | 179 // If the extensions service has finished loading its initial set of |
| 172 // extensions. | 180 // extensions. |
| 173 bool extensions_service_ready_; | 181 bool extensions_service_ready_; |
| 174 | 182 |
| 175 // If list of user scripts is modified while we're loading it, we note | 183 // If list of user scripts is modified while we're loading it, we note |
| 176 // that we're currently mid-load and then start over again once the load | 184 // that we're currently mid-load and then start over again once the load |
| 177 // finishes. This boolean tracks whether another load is pending. | 185 // finishes. This boolean tracks whether another load is pending. |
| 178 bool pending_load_; | 186 bool pending_load_; |
| 179 | 187 |
| 180 // The profile for which the scripts managed here are installed. | 188 // The profile for which the scripts managed here are installed. |
| 181 Profile* profile_; | 189 Profile* profile_; |
| 182 | 190 |
| 183 // Listen to extension load, unloaded notifications. | 191 // Listen to extension load, unloaded notifications. |
| 184 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 192 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 185 extension_registry_observer_; | 193 extension_registry_observer_; |
| 186 | 194 |
| 187 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); | 195 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); |
| 188 }; | 196 }; |
| 189 | 197 |
| 190 } // namespace extensions | 198 } // namespace extensions |
| 191 | 199 |
| 192 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 200 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| OLD | NEW |