| Index: extensions/browser/browser_user_script.cc
|
| diff --git a/extensions/browser/browser_user_script.cc b/extensions/browser/browser_user_script.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ac78a5a81d749f7414acaa201dd6a55488448263
|
| --- /dev/null
|
| +++ b/extensions/browser/browser_user_script.cc
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2016 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/browser_user_script.h"
|
| +
|
| +namespace extensions {
|
| +
|
| +BrowserScriptFile::BrowserScriptFile(const UserScriptFileInfo& info)
|
| + : UserScriptFileInfo(info) {}
|
| +
|
| +BrowserScriptFile::BrowserScriptFile(const base::FilePath& extension_root,
|
| + const base::FilePath& relative_path,
|
| + const GURL& url)
|
| + : UserScriptFileInfo(extension_root, relative_path, url) {}
|
| +
|
| +BrowserScriptFile::~BrowserScriptFile() {}
|
| +
|
| +BrowserUserScript::BrowserUserScript() {}
|
| +
|
| +BrowserUserScript::BrowserUserScript(UserScriptInfo& meta,
|
| + UserScriptFiles<UserScriptFileInfo>& files)
|
| + : UserScriptInfo(meta) {
|
| + js_scripts_.reserve(files.js_scripts().size());
|
| + css_scripts_.reserve(files.css_scripts().size());
|
| + for (const std::unique_ptr<UserScriptFileInfo>& js : files.js_scripts()) {
|
| + std::unique_ptr<BrowserScriptFile> js_with_content(
|
| + new BrowserScriptFile(*js.get()));
|
| + js_scripts_.push_back(std::move(js_with_content));
|
| + }
|
| + for (const std::unique_ptr<UserScriptFileInfo>& css : files.css_scripts()) {
|
| + std::unique_ptr<BrowserScriptFile> css_with_content(
|
| + new BrowserScriptFile(*css.get()));
|
| + css_scripts_.push_back(std::move(css_with_content));
|
| + }
|
| +}
|
| +
|
| +BrowserUserScript::~BrowserUserScript() {}
|
| +
|
| +void BrowserUserScript::Pickle(base::Pickle* pickle) const {
|
| + // Pickle simple types first.
|
| + UserScriptInfo::Pickle(pickle);
|
| + // Then pickle script files.
|
| + UserScriptFiles<BrowserScriptFile>::PickleFiles(pickle);
|
| +}
|
| +
|
| +} // namespace extensions
|
|
|