#include "extensions/browser/embedder_user_script_loader.h"
#include <set>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/url_fetcher.h"
#include "extensions/browser/user_script_loader.h"
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/mojom/host_id.mojom.h"
#include "extensions/common/user_script.h"
#include "url/gurl.h"
#if BUILDFLAG(ENABLE_GUEST_VIEW)
#include "extensions/browser/guest_view/web_view/controlled_frame_embedder_url_fetcher.h"
#include "extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h"
#endif
namespace {
void SerializeOnBlockingTask(
scoped_refptr<base::SequencedTaskRunner> task_runner,
extensions::UserScriptList user_scripts,
extensions::UserScriptLoader::LoadScriptsCallback callback) { … }
}
struct EmbedderUserScriptLoader::UserScriptRenderInfo { … };
EmbedderUserScriptLoader::EmbedderUserScriptLoader(
content::BrowserContext* browser_context,
const extensions::mojom::HostID& host_id)
: … { … }
EmbedderUserScriptLoader::~EmbedderUserScriptLoader() { … }
void EmbedderUserScriptLoader::AddScripts(extensions::UserScriptList scripts,
int render_process_id,
int render_frame_id,
ScriptsLoadedCallback callback) { … }
void EmbedderUserScriptLoader::LoadScripts(
extensions::UserScriptList user_scripts,
const std::set<std::string>& added_script_ids,
LoadScriptsCallback callback) { … }
void EmbedderUserScriptLoader::CreateEmbedderURLFetchers(
const extensions::UserScript::ContentList& contents,
int render_process_id,
int render_frame_id) { … }
void EmbedderUserScriptLoader::OnSingleEmbedderURLFetchComplete(
extensions::UserScript::Content* content,
bool success,
std::unique_ptr<std::string> data) { … }
void EmbedderUserScriptLoader::OnEmbedderURLFetchComplete() { … }