Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/extensions/shared_user_script_master.h

Issue 420543002: Declarative content scripts: Browser-side: per-extension shared memory regions (lazily loaded) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of review comments addressed Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_SHARED_USER_SCRIPT_MASTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_
7
8 #include <set>
9
10 #include "base/scoped_observer.h"
11 #include "chrome/browser/extensions/user_script_loader.h"
12 #include "extensions/browser/extension_registry_observer.h"
13 #include "extensions/common/extension.h"
14 #include "extensions/common/user_script.h"
15
16 namespace content {
17 class BrowserContext;
18 }
19
20 class Profile;
21
22 namespace extensions {
23
24 class ExtensionRegistry;
25
26 // Manages statically-defined user scripts for all extensions. Owns a
27 // UserScriptLoader to which file loading and shared memory management
28 // operations are delegated.
29 class SharedUserScriptMaster : public ExtensionRegistryObserver {
30 public:
31 explicit SharedUserScriptMaster(Profile* profile);
32 virtual ~SharedUserScriptMaster();
33
34 // Provides access to loader state method: scripts_ready().
35 bool scripts_ready() const { return loader_.scripts_ready(); }
36
37 private:
38 // ExtensionRegistryObserver implementation.
39 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
40 const Extension* extension) OVERRIDE;
41 virtual void OnExtensionUnloaded(
42 content::BrowserContext* browser_context,
43 const Extension* extension,
44 UnloadedExtensionInfo::Reason reason) OVERRIDE;
45
46 // Gets an extension's scripts' metadata; i.e., gets a list of UserScript
47 // objects that contains script info, but not the contents of the scripts.
48 const std::set<UserScript>& GetScriptsMetadata(const Extension* extension);
49
50 // Map of extension ID -> list of script metadata for currently-loaded
51 // extensions.
52 std::map<ExtensionId, std::set<UserScript> > scripts_metadata_;
53
54 // Script loader that handles loading contents of scripts into shared memory
55 // and notifying renderers of scripts in shared memory.
56 UserScriptLoader loader_;
57
58 // The profile for which the scripts managed here are installed.
59 Profile* profile_;
60
61 // Listen to extension load, unloaded notifications.
Devlin 2014/08/06 15:59:25 nit: Kill this comment.
Mark Dittmer 2014/08/06 22:08:18 Done.
62 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
63 extension_registry_observer_;
64
65 DISALLOW_COPY_AND_ASSIGN(SharedUserScriptMaster);
66 };
67
68 } // namespace extensions
69
70 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698