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.
5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
8 #include "base/scoped_observer.h"
9 #include "extensions/browser/extension_user_script_loader.h"
15 namespace extensions
{
19 // Manages declarative user scripts for a single extension. Owns a
20 // UserScriptLoader to which file loading and shared memory management
21 // operations are delegated, and provides an interface for adding, removing,
22 // and clearing scripts.
23 class DeclarativeUserScriptMaster
{
25 DeclarativeUserScriptMaster(content::BrowserContext
* browser_context
,
26 const HostID
& host_id
);
27 ~DeclarativeUserScriptMaster();
29 // Adds script to shared memory region. This may not happen right away if a
30 // script load is in progress.
31 void AddScript(const UserScript
& script
);
33 // Removes script from shared memory region. This may not happen right away if
34 // a script load is in progress.
35 void RemoveScript(const UserScript
& script
);
37 // Removes all scripts from shared memory region. This may not happen right
38 // away if a script load is in progress.
41 const HostID
& host_id() const { return host_id_
; }
44 // ID of host that owns scripts that this component manages.
47 // Script loader that handles loading contents of scripts into shared memory
48 // and notifying renderers of script updates.
49 ExtensionUserScriptLoader loader_
;
51 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster
);
54 } // namespace extensions
56 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_