| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 "extensions/browser/browser_user_script.h" |
| 6 |
| 7 namespace extensions { |
| 8 |
| 9 BrowserScriptFile::BrowserScriptFile(const UserScriptFileInfo& info) |
| 10 : UserScriptFileInfo(info) {} |
| 11 |
| 12 BrowserScriptFile::BrowserScriptFile(const base::FilePath& extension_root, |
| 13 const base::FilePath& relative_path, |
| 14 const GURL& url) |
| 15 : UserScriptFileInfo(extension_root, relative_path, url) {} |
| 16 |
| 17 BrowserScriptFile::~BrowserScriptFile() {} |
| 18 |
| 19 BrowserUserScript::BrowserUserScript() {} |
| 20 |
| 21 BrowserUserScript::BrowserUserScript(UserScriptInfo& meta, |
| 22 UserScriptFiles<UserScriptFileInfo>& files) |
| 23 : UserScriptInfo(meta) { |
| 24 js_scripts_.reserve(files.js_scripts().size()); |
| 25 css_scripts_.reserve(files.css_scripts().size()); |
| 26 for (const std::unique_ptr<UserScriptFileInfo>& js : files.js_scripts()) { |
| 27 std::unique_ptr<BrowserScriptFile> js_with_content( |
| 28 new BrowserScriptFile(*js.get())); |
| 29 js_scripts_.push_back(std::move(js_with_content)); |
| 30 } |
| 31 for (const std::unique_ptr<UserScriptFileInfo>& css : files.css_scripts()) { |
| 32 std::unique_ptr<BrowserScriptFile> css_with_content( |
| 33 new BrowserScriptFile(*css.get())); |
| 34 css_scripts_.push_back(std::move(css_with_content)); |
| 35 } |
| 36 } |
| 37 |
| 38 BrowserUserScript::~BrowserUserScript() {} |
| 39 |
| 40 void BrowserUserScript::Pickle(base::Pickle* pickle) const { |
| 41 // Pickle simple types first. |
| 42 UserScriptInfo::Pickle(pickle); |
| 43 // Then pickle script files. |
| 44 UserScriptFiles<BrowserScriptFile>::PickleFiles(pickle); |
| 45 } |
| 46 |
| 47 } // namespace extensions |
| OLD | NEW |