Chromium Code Reviews| Index: chrome/browser/extensions/declarative_user_script_master.h |
| diff --git a/chrome/browser/extensions/declarative_user_script_master.h b/chrome/browser/extensions/declarative_user_script_master.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a774aeb7d3a650d2d2cc68d4c7b92e9f05940db1 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/declarative_user_script_master.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| + |
| +#include "base/scoped_observer.h" |
| +#include "chrome/browser/extensions/user_script_loader.h" |
| +#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.
|
| +#include "extensions/browser/extension_registry_observer.h" |
| +#include "extensions/common/extension.h" |
| + |
| +class Profile; |
| + |
| +namespace extensions { |
| + |
| +class UserScript; |
| + |
| +// Manages declarative user scripts for a single extension. Owns a |
| +// UserScriptLoader to which file loading and shared memory management |
| +// operations are delegated, and provides and interface for adding, removing, |
| +// and clearing scripts. |
| +class DeclarativeUserScriptMaster : public ExtensionRegistryObserver { |
| + public: |
| + DeclarativeUserScriptMaster(Profile* profile, |
| + const ExtensionId& extension_id); |
| + virtual ~DeclarativeUserScriptMaster(); |
| + |
| + // ExtensionRegistryObserver implementation. |
| + virtual void OnExtensionUnloaded( |
|
Devlin
2014/08/05 21:47:26
Privatize.
Mark Dittmer
2014/08/06 15:32:24
Done.
|
| + content::BrowserContext* browser_context, |
| + const Extension* extension, |
| + UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| + |
| + // Adds script to shared memory region. This may not happen right away if a |
| + // script load is in progress. |
| + void AddScript(const UserScript& script); |
| + |
| + // Removes script from shared memory region. This may not happen right away if |
| + // a script load is in progress. |
| + void RemoveScript(const UserScript& script); |
| + |
| + // Removes all scripts from shared memory region. This may not happen right |
| + // away if a script load is in progress. |
| + void ClearScripts(); |
| + |
| + private: |
| + // ID of extension that owns scripts that this component manages. |
| + ExtensionId extension_id_; |
| + |
| + // Script loader that handles loading contents of scripts into shared memory |
| + // 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.
|
| + UserScriptLoader loader_; |
| + |
| + // 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.
|
| + ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| + extension_registry_observer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ |