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

Side by Side Diff: chrome/browser/extensions/declarative_user_script_master.cc

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: Implement changes from code review comments 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 #include "chrome/browser/extensions/declarative_user_script_master.h"
6
7 #include <set>
8
9 #include "chrome/browser/profiles/profile.h"
Devlin 2014/08/05 21:47:26 don't think we actually need this.
Mark Dittmer 2014/08/06 15:32:24 Unfortunately, we do.
10
11 namespace extensions {
12
13 DeclarativeUserScriptMaster::DeclarativeUserScriptMaster(
14 Profile* profile,
15 const ExtensionId& extension_id)
16 : extension_id_(extension_id),
17 loader_(profile,
18 extension_id,
19 false /* listen_for_extension_system_loaded */),
20 extension_registry_observer_(this) {
21 extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
22 }
23
24 DeclarativeUserScriptMaster::~DeclarativeUserScriptMaster() {
25 }
26
27 void DeclarativeUserScriptMaster::OnExtensionUnloaded(
28 content::BrowserContext* browser_context,
29 const Extension* extension,
30 UnloadedExtensionInfo::Reason reason) {
31 if (extension_id_ == extension->id())
32 ClearScripts();
33 }
34
35 void DeclarativeUserScriptMaster::AddScript(const UserScript& script) {
36 std::set<UserScript> set;
37 set.insert(script);
38 loader_.AddScripts(set);
39 }
40
41 void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) {
42 std::set<UserScript> set;
43 set.insert(script);
44 loader_.RemoveScripts(set);
45 }
46
47 void DeclarativeUserScriptMaster::ClearScripts() {
48 loader_.ClearScripts();
49 }
50
51 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698