summaryrefslogtreecommitdiffstats
path: root/extensions/browser/declarative_user_script_master.cc
diff options
context:
space:
mode:
authorhanxi <hanxi@chromium.org>2015-02-24 07:28:07 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-24 15:28:39 +0000
commit3b2b3dfcf72c9216da672ff5c64433655443bce5 (patch)
tree550ab1bce2bf692e9b373ae9fb87d046df39c962 /extensions/browser/declarative_user_script_master.cc
parentb67cd74691c46ad8902a3a0cf8317e757198a57b (diff)
downloadchromium_src-3b2b3dfcf72c9216da672ff5c64433655443bce5.zip
chromium_src-3b2b3dfcf72c9216da672ff5c64433655443bce5.tar.gz
chromium_src-3b2b3dfcf72c9216da672ff5c64433655443bce5.tar.bz2
Move DeclarativeUserScriptManager/Master and UserScriptLoader to //extensions.
BUG=461052 Review URL: https://codereview.chromium.org/955473002 Cr-Commit-Position: refs/heads/master@{#317801}
Diffstat (limited to 'extensions/browser/declarative_user_script_master.cc')
-rw-r--r--extensions/browser/declarative_user_script_master.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/extensions/browser/declarative_user_script_master.cc b/extensions/browser/declarative_user_script_master.cc
new file mode 100644
index 0000000..f16157f
--- /dev/null
+++ b/extensions/browser/declarative_user_script_master.cc
@@ -0,0 +1,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