summaryrefslogtreecommitdiffstats
path: root/extensions/browser/declarative_user_script_master.cc
blob: f16157fce831519bb91b01a9a16ac4e821cfcd29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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.

#include "extensions/browser/declarative_user_script_master.h"

#include <set>

#include "content/public/browser/browser_context.h"

namespace extensions {

DeclarativeUserScriptMaster::DeclarativeUserScriptMaster(
    content::BrowserContext* browser_context,
    const HostID& host_id)
    : host_id_(host_id),
      loader_(browser_context,
              host_id,
              false /* listen_for_extension_system_loaded */) {
}

DeclarativeUserScriptMaster::~DeclarativeUserScriptMaster() {
}

void DeclarativeUserScriptMaster::AddScript(const UserScript& script) {
  std::set<UserScript> set;
  set.insert(script);
  loader_.AddScripts(set);
}

void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) {
  std::set<UserScript> set;
  set.insert(script);
  loader_.RemoveScripts(set);
}

void DeclarativeUserScriptMaster::ClearScripts() {
  loader_.ClearScripts();
}

}  // namespace extensions