1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
12 #include "base/files/file_path.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/version.h"
18 namespace extensions
{
20 // A helper class for keeping track of data for the ContentVerifier that should
21 // only be accessed on the IO thread.
22 class ContentVerifierIOData
23 : public base::RefCountedThreadSafe
<ContentVerifierIOData
> {
25 struct ExtensionData
{
26 std::set
<base::FilePath
> browser_image_paths
;
27 base::Version version
;
29 ExtensionData(const std::set
<base::FilePath
>& browser_image_paths
,
30 const base::Version
& version
);
34 ContentVerifierIOData();
36 void AddData(const std::string
& extension_id
, scoped_ptr
<ExtensionData
> data
);
37 void RemoveData(const std::string
& extension_id
);
40 // This should be called on the IO thread, and the return value should not
41 // be retained or used on other threads.
42 const ExtensionData
* GetData(const std::string
& extension_id
);
45 friend class base::RefCountedThreadSafe
<ContentVerifierIOData
>;
46 virtual ~ContentVerifierIOData();
48 std::map
<std::string
, linked_ptr
<ExtensionData
> > data_map_
;
51 } // namespace extensions
53 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_