Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ | |
| 7 | |
| 8 #include "base/scoped_observer.h" | |
| 9 #include "chrome/browser/extensions/user_script_loader.h" | |
| 10 #include "extensions/browser/extension_registry.h" | |
|
Devlin
2014/08/05 21:47:26
Just need a forward declare here.
Mark Dittmer
2014/08/06 15:32:24
Done.
| |
| 11 #include "extensions/browser/extension_registry_observer.h" | |
| 12 #include "extensions/common/extension.h" | |
| 13 | |
| 14 class Profile; | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 class UserScript; | |
| 19 | |
| 20 // Manages declarative user scripts for a single extension. Owns a | |
| 21 // UserScriptLoader to which file loading and shared memory management | |
| 22 // operations are delegated, and provides and interface for adding, removing, | |
| 23 // and clearing scripts. | |
| 24 class DeclarativeUserScriptMaster : public ExtensionRegistryObserver { | |
| 25 public: | |
| 26 DeclarativeUserScriptMaster(Profile* profile, | |
| 27 const ExtensionId& extension_id); | |
| 28 virtual ~DeclarativeUserScriptMaster(); | |
| 29 | |
| 30 // ExtensionRegistryObserver implementation. | |
| 31 virtual void OnExtensionUnloaded( | |
|
Devlin
2014/08/05 21:47:26
Privatize.
Mark Dittmer
2014/08/06 15:32:24
Done.
| |
| 32 content::BrowserContext* browser_context, | |
| 33 const Extension* extension, | |
| 34 UnloadedExtensionInfo::Reason reason) OVERRIDE; | |
| 35 | |
| 36 // Adds script to shared memory region. This may not happen right away if a | |
| 37 // script load is in progress. | |
| 38 void AddScript(const UserScript& script); | |
| 39 | |
| 40 // Removes script from shared memory region. This may not happen right away if | |
| 41 // a script load is in progress. | |
| 42 void RemoveScript(const UserScript& script); | |
| 43 | |
| 44 // Removes all scripts from shared memory region. This may not happen right | |
| 45 // away if a script load is in progress. | |
| 46 void ClearScripts(); | |
| 47 | |
| 48 private: | |
| 49 // ID of extension that owns scripts that this component manages. | |
| 50 ExtensionId extension_id_; | |
| 51 | |
| 52 // Script loader that handles loading contents of scripts into shared memory | |
| 53 // and notifying renderers of scripts in shared memory. | |
|
Devlin
2014/08/05 21:47:26
s/scripts in shared memory/script updates
Mark Dittmer
2014/08/06 15:32:25
Done.
| |
| 54 UserScriptLoader loader_; | |
| 55 | |
| 56 // Listen to unloaded notifications. | |
|
Devlin
2014/08/05 21:47:26
Eh, not really a useful comment here (since we can
Mark Dittmer
2014/08/06 15:32:25
Done.
| |
| 57 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | |
| 58 extension_registry_observer_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); | |
| 61 }; | |
| 62 | |
| 63 } // namespace extensions | |
| 64 | |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ | |
| OLD | NEW |