blob: ecba0b45bcb1156920a3dff51bf6ae1d9d88da80 [file] [log] [blame]
// 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 <map>
#include <memory>
#include <set>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/version.h"
namespace extensions {
// A helper class for keeping track of data for the ContentVerifier that should
// only be accessed on the IO thread.
class ContentVerifierIOData
: public base::RefCountedThreadSafe<ContentVerifierIOData> {
struct ExtensionData {
// Set of images file paths used within the browser process.
std::unique_ptr<std::set<base::FilePath>> browser_image_paths;
// Set of file paths used as background scripts, pages or content scripts.
std::unique_ptr<std::set<base::FilePath>> background_or_content_paths;
base::Version version;
std::unique_ptr<std::set<base::FilePath>> browser_image_paths,
std::unique_ptr<std::set<base::FilePath>> background_or_content_paths,
const base::Version& version);
void AddData(const std::string& extension_id,
std::unique_ptr<ExtensionData> data);
void RemoveData(const std::string& extension_id);
void Clear();
// This should be called on the IO thread, and the return value should not
// be retained or used on other threads.
const ExtensionData* GetData(const std::string& extension_id);
friend class base::RefCountedThreadSafe<ContentVerifierIOData>;
virtual ~ContentVerifierIOData();
std::map<std::string, std::unique_ptr<ExtensionData>> data_map_;
} // namespace extensions